1
2
3
4
5
6
7
8
9
10
11 #include <asm/pdc.h>
12 #include <asm/psw.h>
13 #include <asm/assembly.h>
14 #include <asm/asm-offsets.h>
15
16 #include <linux/linkage.h>
17
18
19 .section .bss
20
21 .export pdc_result
22 .export pdc_result2
23 .align 8
24 pdc_result:
25 .block ASM_PDC_RESULT_SIZE
26 pdc_result2:
27 .block ASM_PDC_RESULT_SIZE
28
29 .export real_stack
30 .export real32_stack
31 .export real64_stack
32 .align 64
33 real_stack:
34 real32_stack:
35 real64_stack:
36 .block 8192
37
38 #define N_SAVED_REGS 9
39
40 save_cr_space:
41 .block REG_SZ * N_SAVED_REGS
42 save_cr_end:
43
44
45
46
47
48 .text
49
50
51
52
53
54
55
56
57
58 ENTRY_CFI(real32_call_asm)
59 STREG %rp, -RP_OFFSET(%sp)
60 #ifdef CONFIG_64BIT
61 callee_save
62 ldo 2*REG_SZ(%sp), %sp
63 STREG %r27, -1*REG_SZ(%sp)
64 STREG %r29, -2*REG_SZ(%sp)
65 #endif
66 STREG %sp, -REG_SZ(%arg0)
67 copy %arg0, %sp
68
69
70 copy %arg2, %r31
71
72
73
74 ldw 0(%arg1), %arg0
75 ldw -8(%arg1), %arg2
76 ldw -12(%arg1), %arg3
77 ldw -4(%arg1), %arg1
78
79 tophys_r1 %sp
80
81 b,l rfi_virt2real,%r2
82 nop
83
84 b,l save_control_regs,%r2
85 nop
86
87 #ifdef CONFIG_64BIT
88 rsm PSW_SM_W, %r0
89 #endif
90
91 load32 PA(ric_ret), %r2
92 bv 0(%r31)
93 nop
94 ric_ret:
95 #ifdef CONFIG_64BIT
96 ssm PSW_SM_W, %r0
97 #endif
98
99 b,l restore_control_regs, %r2
100 nop
101
102 b,l rfi_real2virt,%r2
103 nop
104
105 tovirt_r1 %sp
106 LDREG -REG_SZ(%sp), %sp
107 #ifdef CONFIG_64BIT
108 LDREG -1*REG_SZ(%sp), %r27
109 LDREG -2*REG_SZ(%sp), %r29
110 ldo -2*REG_SZ(%sp), %sp
111 callee_rest
112 #endif
113 LDREG -RP_OFFSET(%sp), %rp
114 bv 0(%rp)
115 nop
116 ENDPROC_CFI(real32_call_asm)
117
118
119 # define PUSH_CR(r, where) mfctl r, %r1 ! STREG,ma %r1, REG_SZ(where)
120 # define POP_CR(r, where) LDREG,mb -REG_SZ(where), %r1 ! mtctl %r1, r
121
122 .text
123 ENTRY_CFI(save_control_regs)
124 load32 PA(save_cr_space), %r28
125 PUSH_CR(%cr24, %r28)
126 PUSH_CR(%cr25, %r28)
127 PUSH_CR(%cr26, %r28)
128 PUSH_CR(%cr27, %r28)
129 PUSH_CR(%cr28, %r28)
130 PUSH_CR(%cr29, %r28)
131 PUSH_CR(%cr30, %r28)
132 PUSH_CR(%cr31, %r28)
133 PUSH_CR(%cr15, %r28)
134 bv 0(%r2)
135 nop
136 ENDPROC_CFI(save_control_regs)
137
138 ENTRY_CFI(restore_control_regs)
139 load32 PA(save_cr_end), %r26
140 POP_CR(%cr15, %r26)
141 POP_CR(%cr31, %r26)
142 POP_CR(%cr30, %r26)
143 POP_CR(%cr29, %r26)
144 POP_CR(%cr28, %r26)
145 POP_CR(%cr27, %r26)
146 POP_CR(%cr26, %r26)
147 POP_CR(%cr25, %r26)
148 POP_CR(%cr24, %r26)
149 bv 0(%r2)
150 nop
151 ENDPROC_CFI(restore_control_regs)
152
153
154
155
156 .text
157 .align 128
158 ENTRY_CFI(rfi_virt2real)
159 #if !defined(BOOTLOADER)
160
161 rsm PSW_SM_I,%r0
162 load32 PA(rfi_v2r_1), %r1
163 nop
164 nop
165 nop
166 nop
167 nop
168
169 rsm PSW_SM_Q,%r0
170 mtctl %r0, %cr17
171 mtctl %r0, %cr17
172 mtctl %r1, %cr18
173 ldo 4(%r1), %r1
174 mtctl %r1, %cr18
175 load32 REAL_MODE_PSW, %r1
176 mtctl %r1, %cr22
177 rfi
178
179 nop
180 nop
181 nop
182 nop
183 nop
184 nop
185 nop
186 nop
187 rfi_v2r_1:
188 tophys_r1 %r2
189 #endif
190 bv 0(%r2)
191 nop
192 ENDPROC_CFI(rfi_virt2real)
193
194 .text
195 .align 128
196 ENTRY_CFI(rfi_real2virt)
197 #if !defined(BOOTLOADER)
198 rsm PSW_SM_I,%r0
199 load32 (rfi_r2v_1), %r1
200 nop
201 nop
202 nop
203 nop
204 nop
205
206 rsm PSW_SM_Q,%r0
207 mtctl %r0, %cr17
208 mtctl %r0, %cr17
209 mtctl %r1, %cr18
210 ldo 4(%r1), %r1
211 mtctl %r1, %cr18
212 load32 KERNEL_PSW, %r1
213 mtctl %r1, %cr22
214 rfi
215
216 nop
217 nop
218 nop
219 nop
220 nop
221 nop
222 nop
223 nop
224 rfi_r2v_1:
225 tovirt_r1 %r2
226 #endif
227 bv 0(%r2)
228 nop
229 ENDPROC_CFI(rfi_real2virt)
230
231 #ifdef CONFIG_64BIT
232
233
234
235 .text
236
237
238
239
240
241
242
243 ENTRY_CFI(real64_call_asm)
244 std %rp, -0x10(%sp)
245 std %sp, -8(%arg0)
246 copy %arg0, %sp
247
248
249 copy %arg2, %r31
250
251
252 ldo 64(%arg1), %r29
253
254
255
256 ldd 0*REG_SZ(%arg1), %arg0
257 ldd 2*REG_SZ(%arg1), %arg2
258 ldd 3*REG_SZ(%arg1), %arg3
259 ldd 4*REG_SZ(%arg1), %r22
260 ldd 5*REG_SZ(%arg1), %r21
261 ldd 6*REG_SZ(%arg1), %r20
262 ldd 7*REG_SZ(%arg1), %r19
263 ldd 1*REG_SZ(%arg1), %arg1
264
265 tophys_r1 %sp
266
267 b,l rfi_virt2real,%r2
268 nop
269
270 b,l save_control_regs,%r2
271 nop
272
273 load32 PA(r64_ret), %r2
274 bv 0(%r31)
275 nop
276 r64_ret:
277
278 b,l restore_control_regs, %r2
279 nop
280
281 b,l rfi_real2virt,%r2
282 nop
283
284 tovirt_r1 %sp
285 ldd -8(%sp), %sp
286 ldd -0x10(%sp), %rp
287 bv 0(%rp)
288 nop
289 ENDPROC_CFI(real64_call_asm)
290
291 #endif
292
293 .text
294
295
296
297
298 ENTRY_CFI(__canonicalize_funcptr_for_compare)
299 #ifdef CONFIG_64BIT
300 bve (%r2)
301 #else
302 bv %r0(%r2)
303 #endif
304 copy %r26,%r28
305 ENDPROC_CFI(__canonicalize_funcptr_for_compare)
306