base.S 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /*
  2. * arch/s390/kernel/base.S
  3. *
  4. * Copyright IBM Corp. 2006, 2007
  5. * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
  6. * Michael Holzheu <holzheu@de.ibm.com>
  7. */
  8. #include <linux/linkage.h>
  9. #include <asm/asm-offsets.h>
  10. #include <asm/nospec-insn.h>
  11. #include <asm/ptrace.h>
  12. #include <asm/sigp.h>
  13. GEN_BR_THUNK %r9
  14. GEN_BR_THUNK %r14
  15. ENTRY(s390_base_mcck_handler)
  16. basr %r13,0
  17. 0: lg %r15,__LC_PANIC_STACK # load panic stack
  18. aghi %r15,-STACK_FRAME_OVERHEAD
  19. larl %r1,s390_base_mcck_handler_fn
  20. lg %r9,0(%r1)
  21. ltgr %r9,%r9
  22. jz 1f
  23. BASR_EX %r14,%r9
  24. 1: la %r1,4095
  25. lmg %r0,%r15,__LC_GPREGS_SAVE_AREA-4095(%r1)
  26. lpswe __LC_MCK_OLD_PSW
  27. .section .bss
  28. .align 8
  29. .globl s390_base_mcck_handler_fn
  30. s390_base_mcck_handler_fn:
  31. .quad 0
  32. .previous
  33. ENTRY(s390_base_ext_handler)
  34. stmg %r0,%r15,__LC_SAVE_AREA_ASYNC
  35. basr %r13,0
  36. 0: aghi %r15,-STACK_FRAME_OVERHEAD
  37. larl %r1,s390_base_ext_handler_fn
  38. lg %r9,0(%r1)
  39. ltgr %r9,%r9
  40. jz 1f
  41. BASR_EX %r14,%r9
  42. 1: lmg %r0,%r15,__LC_SAVE_AREA_ASYNC
  43. ni __LC_EXT_OLD_PSW+1,0xfd # clear wait state bit
  44. lpswe __LC_EXT_OLD_PSW
  45. .section .bss
  46. .align 8
  47. .globl s390_base_ext_handler_fn
  48. s390_base_ext_handler_fn:
  49. .quad 0
  50. .previous
  51. ENTRY(s390_base_pgm_handler)
  52. stmg %r0,%r15,__LC_SAVE_AREA_SYNC
  53. basr %r13,0
  54. 0: aghi %r15,-STACK_FRAME_OVERHEAD
  55. larl %r1,s390_base_pgm_handler_fn
  56. lg %r9,0(%r1)
  57. ltgr %r9,%r9
  58. jz 1f
  59. BASR_EX %r14,%r9
  60. lmg %r0,%r15,__LC_SAVE_AREA_SYNC
  61. lpswe __LC_PGM_OLD_PSW
  62. 1: lpswe disabled_wait_psw-0b(%r13)
  63. .align 8
  64. disabled_wait_psw:
  65. .quad 0x0002000180000000,0x0000000000000000 + s390_base_pgm_handler
  66. .section .bss
  67. .align 8
  68. .globl s390_base_pgm_handler_fn
  69. s390_base_pgm_handler_fn:
  70. .quad 0
  71. .previous
  72. #
  73. # Calls diag 308 subcode 1 and continues execution
  74. #
  75. ENTRY(diag308_reset)
  76. larl %r4,.Lctlregs # Save control registers
  77. stctg %c0,%c15,0(%r4)
  78. lg %r2,0(%r4) # Disable lowcore protection
  79. nilh %r2,0xefff
  80. larl %r4,.Lctlreg0
  81. stg %r2,0(%r4)
  82. lctlg %c0,%c0,0(%r4)
  83. larl %r4,.Lfpctl # Floating point control register
  84. stfpc 0(%r4)
  85. larl %r4,.Lprefix # Save prefix register
  86. stpx 0(%r4)
  87. larl %r4,.Lprefix_zero # Set prefix register to 0
  88. spx 0(%r4)
  89. larl %r4,.Lcontinue_psw # Save PSW flags
  90. epsw %r2,%r3
  91. stm %r2,%r3,0(%r4)
  92. larl %r4,.Lrestart_psw # Setup restart PSW at absolute 0
  93. lghi %r3,0
  94. lg %r4,0(%r4) # Save PSW
  95. sturg %r4,%r3 # Use sturg, because of large pages
  96. lghi %r1,1
  97. lghi %r0,0
  98. diag %r0,%r1,0x308
  99. .Lrestart_part2:
  100. lhi %r0,0 # Load r0 with zero
  101. lhi %r1,2 # Use mode 2 = ESAME (dump)
  102. sigp %r1,%r0,SIGP_SET_ARCHITECTURE # Switch to ESAME mode
  103. sam64 # Switch to 64 bit addressing mode
  104. larl %r4,.Lctlregs # Restore control registers
  105. lctlg %c0,%c15,0(%r4)
  106. larl %r4,.Lfpctl # Restore floating point ctl register
  107. lfpc 0(%r4)
  108. larl %r4,.Lprefix # Restore prefix register
  109. spx 0(%r4)
  110. larl %r4,.Lcontinue_psw # Restore PSW flags
  111. lpswe 0(%r4)
  112. .Lcontinue:
  113. BR_EX %r14
  114. .align 16
  115. .Lrestart_psw:
  116. .long 0x00080000,0x80000000 + .Lrestart_part2
  117. .section .data..nosave,"aw",@progbits
  118. .align 8
  119. .Lcontinue_psw:
  120. .quad 0,.Lcontinue
  121. .previous
  122. .section .bss
  123. .align 8
  124. .Lctlreg0:
  125. .quad 0
  126. .Lctlregs:
  127. .rept 16
  128. .quad 0
  129. .endr
  130. .Lfpctl:
  131. .long 0
  132. .Lprefix:
  133. .long 0
  134. .Lprefix_zero:
  135. .long 0
  136. .previous