1 /* SPDX-License-Identifier: GPL-2.0 */
3 * arch/s390/kernel/base.S
5 * Copyright IBM Corp. 2006, 2007
6 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
7 * Michael Holzheu <holzheu@de.ibm.com>
10 #include <linux/linkage.h>
11 #include <asm/asm-offsets.h>
12 #include <asm/nospec-insn.h>
13 #include <asm/ptrace.h>
19 ENTRY(s390_base_mcck_handler)
21 0: lg %r15,__LC_PANIC_STACK # load panic stack
22 aghi %r15,-STACK_FRAME_OVERHEAD
23 larl %r1,s390_base_mcck_handler_fn
29 lmg %r0,%r15,__LC_GPREGS_SAVE_AREA-4095(%r1)
30 lpswe __LC_MCK_OLD_PSW
34 .globl s390_base_mcck_handler_fn
35 s390_base_mcck_handler_fn:
39 ENTRY(s390_base_ext_handler)
40 stmg %r0,%r15,__LC_SAVE_AREA_ASYNC
42 0: aghi %r15,-STACK_FRAME_OVERHEAD
43 larl %r1,s390_base_ext_handler_fn
48 1: lmg %r0,%r15,__LC_SAVE_AREA_ASYNC
49 ni __LC_EXT_OLD_PSW+1,0xfd # clear wait state bit
50 lpswe __LC_EXT_OLD_PSW
54 .globl s390_base_ext_handler_fn
55 s390_base_ext_handler_fn:
59 ENTRY(s390_base_pgm_handler)
60 stmg %r0,%r15,__LC_SAVE_AREA_SYNC
62 0: aghi %r15,-STACK_FRAME_OVERHEAD
63 larl %r1,s390_base_pgm_handler_fn
68 lmg %r0,%r15,__LC_SAVE_AREA_SYNC
69 lpswe __LC_PGM_OLD_PSW
70 1: lpswe disabled_wait_psw-0b(%r13)
74 .quad 0x0002000180000000,0x0000000000000000 + s390_base_pgm_handler
78 .globl s390_base_pgm_handler_fn
79 s390_base_pgm_handler_fn:
84 # Calls diag 308 subcode 1 and continues execution
87 larl %r4,.Lctlregs # Save control registers
89 lg %r2,0(%r4) # Disable lowcore protection
94 larl %r4,.Lfpctl # Floating point control register
96 larl %r4,.Lprefix # Save prefix register
98 larl %r4,.Lprefix_zero # Set prefix register to 0
100 larl %r4,.Lcontinue_psw # Save PSW flags
103 larl %r4,.Lrestart_psw # Setup restart PSW at absolute 0
105 lg %r4,0(%r4) # Save PSW
106 sturg %r4,%r3 # Use sturg, because of large pages
111 lhi %r0,0 # Load r0 with zero
112 lhi %r1,2 # Use mode 2 = ESAME (dump)
113 sigp %r1,%r0,SIGP_SET_ARCHITECTURE # Switch to ESAME mode
114 sam64 # Switch to 64 bit addressing mode
115 larl %r4,.Lctlregs # Restore control registers
116 lctlg %c0,%c15,0(%r4)
117 larl %r4,.Lfpctl # Restore floating point ctl register
119 larl %r4,.Lprefix # Restore prefix register
121 larl %r4,.Lcontinue_psw # Restore PSW flags
127 .long 0x00080000,0x80000000 + .Lrestart_part2
129 .section .data..nosave,"aw",@progbits