Linux 3.16-rc2
[linux/fpc-iii.git] / arch / s390 / kernel / base.S
blob797a823a22755d9b76f8c12717e043226c7395bd
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  */
9 #include <linux/linkage.h>
10 #include <asm/asm-offsets.h>
11 #include <asm/ptrace.h>
12 #include <asm/sigp.h>
14 #ifdef CONFIG_64BIT
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      %r1,0(%r1)
22         ltgr    %r1,%r1
23         jz      1f
24         basr    %r14,%r1
25 1:      la      %r1,4095
26         lmg     %r0,%r15,__LC_GPREGS_SAVE_AREA-4095(%r1)
27         lpswe   __LC_MCK_OLD_PSW
29         .section .bss
30         .align 8
31         .globl  s390_base_mcck_handler_fn
32 s390_base_mcck_handler_fn:
33         .quad   0
34         .previous
36 ENTRY(s390_base_ext_handler)
37         stmg    %r0,%r15,__LC_SAVE_AREA_ASYNC
38         basr    %r13,0
39 0:      aghi    %r15,-STACK_FRAME_OVERHEAD
40         larl    %r1,s390_base_ext_handler_fn
41         lg      %r1,0(%r1)
42         ltgr    %r1,%r1
43         jz      1f
44         basr    %r14,%r1
45 1:      lmg     %r0,%r15,__LC_SAVE_AREA_ASYNC
46         ni      __LC_EXT_OLD_PSW+1,0xfd # clear wait state bit
47         lpswe   __LC_EXT_OLD_PSW
49         .section .bss
50         .align 8
51         .globl s390_base_ext_handler_fn
52 s390_base_ext_handler_fn:
53         .quad   0
54         .previous
56 ENTRY(s390_base_pgm_handler)
57         stmg    %r0,%r15,__LC_SAVE_AREA_SYNC
58         basr    %r13,0
59 0:      aghi    %r15,-STACK_FRAME_OVERHEAD
60         larl    %r1,s390_base_pgm_handler_fn
61         lg      %r1,0(%r1)
62         ltgr    %r1,%r1
63         jz      1f
64         basr    %r14,%r1
65         lmg     %r0,%r15,__LC_SAVE_AREA_SYNC
66         lpswe   __LC_PGM_OLD_PSW
67 1:      lpswe   disabled_wait_psw-0b(%r13)
69         .align  8
70 disabled_wait_psw:
71         .quad   0x0002000180000000,0x0000000000000000 + s390_base_pgm_handler
73         .section .bss
74         .align 8
75         .globl s390_base_pgm_handler_fn
76 s390_base_pgm_handler_fn:
77         .quad   0
78         .previous
81 # Calls diag 308 subcode 1 and continues execution
83 # The following conditions must be ensured before calling this function:
84 # * Prefix register = 0
85 # * Lowcore protection is disabled
87 ENTRY(diag308_reset)
88         larl    %r4,.Lctlregs           # Save control registers
89         stctg   %c0,%c15,0(%r4)
90         larl    %r4,.Lfpctl             # Floating point control register
91         stfpc   0(%r4)
92         larl    %r4,.Lcontinue_psw      # Save PSW flags
93         epsw    %r2,%r3
94         stm     %r2,%r3,0(%r4)
95         larl    %r4,.Lrestart_psw       # Setup restart PSW at absolute 0
96         lghi    %r3,0
97         lg      %r4,0(%r4)              # Save PSW
98         sturg   %r4,%r3                 # Use sturg, because of large pages
99         lghi    %r1,1
100         diag    %r1,%r1,0x308
101 .Lrestart_part2:
102         lhi     %r0,0                   # Load r0 with zero
103         lhi     %r1,2                   # Use mode 2 = ESAME (dump)
104         sigp    %r1,%r0,SIGP_SET_ARCHITECTURE   # Switch to ESAME mode
105         sam64                           # Switch to 64 bit addressing mode
106         larl    %r4,.Lctlregs           # Restore control registers
107         lctlg   %c0,%c15,0(%r4)
108         larl    %r4,.Lfpctl             # Restore floating point ctl register
109         lfpc    0(%r4)
110         larl    %r4,.Lcontinue_psw      # Restore PSW flags
111         lpswe   0(%r4)
112 .Lcontinue:
113         br      %r14
114 .align 16
115 .Lrestart_psw:
116         .long   0x00080000,0x80000000 + .Lrestart_part2
118         .section .data..nosave,"aw",@progbits
119 .align 8
120 .Lcontinue_psw:
121         .quad   0,.Lcontinue
122         .previous
124         .section .bss
125 .align 8
126 .Lctlregs:
127         .rept   16
128         .quad   0
129         .endr
130 .Lfpctl:
131         .long   0
132         .previous
134 #else /* CONFIG_64BIT */
136 ENTRY(s390_base_mcck_handler)
137         basr    %r13,0
138 0:      l       %r15,__LC_PANIC_STACK   # load panic stack
139         ahi     %r15,-STACK_FRAME_OVERHEAD
140         l       %r1,2f-0b(%r13)
141         l       %r1,0(%r1)
142         ltr     %r1,%r1
143         jz      1f
144         basr    %r14,%r1
145 1:      lm      %r0,%r15,__LC_GPREGS_SAVE_AREA
146         lpsw    __LC_MCK_OLD_PSW
148 2:      .long   s390_base_mcck_handler_fn
150         .section .bss
151         .align 4
152         .globl  s390_base_mcck_handler_fn
153 s390_base_mcck_handler_fn:
154         .long   0
155         .previous
157 ENTRY(s390_base_ext_handler)
158         stm     %r0,%r15,__LC_SAVE_AREA_ASYNC
159         basr    %r13,0
160 0:      ahi     %r15,-STACK_FRAME_OVERHEAD
161         l       %r1,2f-0b(%r13)
162         l       %r1,0(%r1)
163         ltr     %r1,%r1
164         jz      1f
165         basr    %r14,%r1
166 1:      lm      %r0,%r15,__LC_SAVE_AREA_ASYNC
167         ni      __LC_EXT_OLD_PSW+1,0xfd # clear wait state bit
168         lpsw    __LC_EXT_OLD_PSW
170 2:      .long   s390_base_ext_handler_fn
172         .section .bss
173         .align 4
174         .globl  s390_base_ext_handler_fn
175 s390_base_ext_handler_fn:
176         .long   0
177         .previous
179 ENTRY(s390_base_pgm_handler)
180         stm     %r0,%r15,__LC_SAVE_AREA_SYNC
181         basr    %r13,0
182 0:      ahi     %r15,-STACK_FRAME_OVERHEAD
183         l       %r1,2f-0b(%r13)
184         l       %r1,0(%r1)
185         ltr     %r1,%r1
186         jz      1f
187         basr    %r14,%r1
188         lm      %r0,%r15,__LC_SAVE_AREA_SYNC
189         lpsw    __LC_PGM_OLD_PSW
191 1:      lpsw    disabled_wait_psw-0b(%r13)
193 2:      .long   s390_base_pgm_handler_fn
195 disabled_wait_psw:
196         .align  8
197         .long   0x000a0000,0x00000000 + s390_base_pgm_handler
199         .section .bss
200         .align 4
201         .globl  s390_base_pgm_handler_fn
202 s390_base_pgm_handler_fn:
203         .long   0
204         .previous
206 #endif /* CONFIG_64BIT */