base.S 3.2 KB

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