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/ptrace.h>
15 ENTRY(s390_base_mcck_handler)
17 0: lg %r15,__LC_PANIC_STACK # load panic stack
18 aghi %r15,-STACK_FRAME_OVERHEAD
19 larl %r1,s390_base_mcck_handler_fn
25 lmg %r0,%r15,__LC_GPREGS_SAVE_AREA-4095(%r1)
26 lpswe __LC_MCK_OLD_PSW
30 .globl s390_base_mcck_handler_fn
31 s390_base_mcck_handler_fn:
35 ENTRY(s390_base_ext_handler)
36 stmg %r0,%r15,__LC_SAVE_AREA_ASYNC
38 0: aghi %r15,-STACK_FRAME_OVERHEAD
39 larl %r1,s390_base_ext_handler_fn
44 1: lmg %r0,%r15,__LC_SAVE_AREA_ASYNC
45 ni __LC_EXT_OLD_PSW+1,0xfd # clear wait state bit
46 lpswe __LC_EXT_OLD_PSW
50 .globl s390_base_ext_handler_fn
51 s390_base_ext_handler_fn:
55 ENTRY(s390_base_pgm_handler)
56 stmg %r0,%r15,__LC_SAVE_AREA_SYNC
58 0: aghi %r15,-STACK_FRAME_OVERHEAD
59 larl %r1,s390_base_pgm_handler_fn
64 lmg %r0,%r15,__LC_SAVE_AREA_SYNC
65 lpswe __LC_PGM_OLD_PSW
66 1: lpswe disabled_wait_psw-0b(%r13)
70 .quad 0x0002000180000000,0x0000000000000000 + s390_base_pgm_handler
74 .globl s390_base_pgm_handler_fn
75 s390_base_pgm_handler_fn:
80 # Calls diag 308 subcode 1 and continues execution
83 larl %r4,.Lctlregs # Save control registers
85 lg %r2,0(%r4) # Disable lowcore protection
90 larl %r4,.Lfpctl # Floating point control register
92 larl %r4,.Lprefix # Save prefix register
94 larl %r4,.Lprefix_zero # Set prefix register to 0
96 larl %r4,.Lcontinue_psw # Save PSW flags
99 larl %r4,.Lrestart_psw # Setup restart PSW at absolute 0
101 lg %r4,0(%r4) # Save PSW
102 sturg %r4,%r3 # Use sturg, because of large pages
107 lhi %r0,0 # Load r0 with zero
108 lhi %r1,2 # Use mode 2 = ESAME (dump)
109 sigp %r1,%r0,SIGP_SET_ARCHITECTURE # Switch to ESAME mode
110 sam64 # Switch to 64 bit addressing mode
111 larl %r4,.Lctlregs # Restore control registers
112 lctlg %c0,%c15,0(%r4)
113 larl %r4,.Lfpctl # Restore floating point ctl register
115 larl %r4,.Lprefix # Restore prefix register
117 larl %r4,.Lcontinue_psw # Restore PSW flags
123 .long 0x00080000,0x80000000 + .Lrestart_part2
125 .section .data..nosave,"aw",@progbits