Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / arch / s390 / kernel / base.S
blobf6c56009e822473d701cecbc896d3693b080d6c2
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  */
10 #include <linux/linkage.h>
11 #include <asm/asm-offsets.h>
12 #include <asm/ptrace.h>
13 #include <asm/sigp.h>
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      %r1,0(%r1)
21         ltgr    %r1,%r1
22         jz      1f
23         basr    %r14,%r1
24 1:      la      %r1,4095
25         lmg     %r0,%r15,__LC_GPREGS_SAVE_AREA-4095(%r1)
26         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
35 ENTRY(s390_base_ext_handler)
36         stmg    %r0,%r15,__LC_SAVE_AREA_ASYNC
37         basr    %r13,0
38 0:      aghi    %r15,-STACK_FRAME_OVERHEAD
39         larl    %r1,s390_base_ext_handler_fn
40         lg      %r1,0(%r1)
41         ltgr    %r1,%r1
42         jz      1f
43         basr    %r14,%r1
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
48         .section .bss
49         .align 8
50         .globl s390_base_ext_handler_fn
51 s390_base_ext_handler_fn:
52         .quad   0
53         .previous
55 ENTRY(s390_base_pgm_handler)
56         stmg    %r0,%r15,__LC_SAVE_AREA_SYNC
57         basr    %r13,0
58 0:      aghi    %r15,-STACK_FRAME_OVERHEAD
59         larl    %r1,s390_base_pgm_handler_fn
60         lg      %r1,0(%r1)
61         ltgr    %r1,%r1
62         jz      1f
63         basr    %r14,%r1
64         lmg     %r0,%r15,__LC_SAVE_AREA_SYNC
65         lpswe   __LC_PGM_OLD_PSW
66 1:      lpswe   disabled_wait_psw-0b(%r13)
68         .align  8
69 disabled_wait_psw:
70         .quad   0x0002000180000000,0x0000000000000000 + s390_base_pgm_handler
72         .section .bss
73         .align 8
74         .globl s390_base_pgm_handler_fn
75 s390_base_pgm_handler_fn:
76         .quad   0
77         .previous
80 # Calls diag 308 subcode 1 and continues execution
82 ENTRY(diag308_reset)
83         larl    %r4,.Lctlregs           # Save control registers
84         stctg   %c0,%c15,0(%r4)
85         lg      %r2,0(%r4)              # Disable lowcore protection
86         nilh    %r2,0xefff
87         larl    %r4,.Lctlreg0
88         stg     %r2,0(%r4)
89         lctlg   %c0,%c0,0(%r4)
90         larl    %r4,.Lfpctl             # Floating point control register
91         stfpc   0(%r4)
92         larl    %r4,.Lprefix            # Save prefix register
93         stpx    0(%r4)
94         larl    %r4,.Lprefix_zero       # Set prefix register to 0
95         spx     0(%r4)
96         larl    %r4,.Lcontinue_psw      # Save PSW flags
97         epsw    %r2,%r3
98         stm     %r2,%r3,0(%r4)
99         larl    %r4,.Lrestart_psw       # Setup restart PSW at absolute 0
100         lghi    %r3,0
101         lg      %r4,0(%r4)              # Save PSW
102         sturg   %r4,%r3                 # Use sturg, because of large pages
103         lghi    %r1,1
104         lghi    %r0,0
105         diag    %r0,%r1,0x308
106 .Lrestart_part2:
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
114         lfpc    0(%r4)
115         larl    %r4,.Lprefix            # Restore prefix register
116         spx     0(%r4)
117         larl    %r4,.Lcontinue_psw      # Restore PSW flags
118         lpswe   0(%r4)
119 .Lcontinue:
120         br      %r14
121 .align 16
122 .Lrestart_psw:
123         .long   0x00080000,0x80000000 + .Lrestart_part2
125         .section .data..nosave,"aw",@progbits
126 .align 8
127 .Lcontinue_psw:
128         .quad   0,.Lcontinue
129         .previous
131         .section .bss
132 .align 8
133 .Lctlreg0:
134         .quad   0
135 .Lctlregs:
136         .rept   16
137         .quad   0
138         .endr
139 .Lfpctl:
140         .long   0
141 .Lprefix:
142         .long   0
143 .Lprefix_zero:
144         .long   0
145         .previous