1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#include <asm/asmmacro.h>
16#include <asm/processor.h>
17
18 .data
19pal_entry_point:
20 data8 ia64_pal_default_handler
21 .text
22
23
24
25
26
27
28
29
30
31GLOBAL_ENTRY(ia64_pal_handler_init)
32 alloc r3=ar.pfs,1,0,0,0
33 movl r2=pal_entry_point
34 ;;
35 st8 [r2]=in0
36 br.ret.sptk.many rp
37END(ia64_pal_handler_init)
38
39
40
41
42
43
44GLOBAL_ENTRY(ia64_pal_default_handler)
45 mov r8=-1
46 br.cond.sptk.many rp
47END(ia64_pal_default_handler)
48
49
50
51
52
53
54
55GLOBAL_ENTRY(ia64_pal_call_static)
56 .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(4)
57 alloc loc1 = ar.pfs,4,5,0,0
58 movl loc2 = pal_entry_point
591: {
60 mov r28 = in0
61 mov r29 = in1
62 mov r8 = ip
63 }
64 ;;
65 ld8 loc2 = [loc2]
66 adds r8 = 1f-1b,r8
67 mov loc4=ar.rsc
68 ;;
69 mov ar.rsc=0
70 mov loc3 = psr
71 mov loc0 = rp
72 .body
73 mov r30 = in2
74
75 mov r31 = in3
76 mov b7 = loc2
77
78 rsm psr.i
79 ;;
80 mov rp = r8
81 br.cond.sptk.many b7
821: mov psr.l = loc3
83 mov ar.rsc = loc4
84 mov ar.pfs = loc1
85 mov rp = loc0
86 ;;
87 srlz.d
88 br.ret.sptk.many b0
89END(ia64_pal_call_static)
90
91
92
93
94
95
96
97
98GLOBAL_ENTRY(ia64_pal_call_stacked)
99 .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(4)
100 alloc loc1 = ar.pfs,4,4,4,0
101 movl loc2 = pal_entry_point
102
103 mov r28 = in0
104 mov out0 = in0
105 mov loc0 = rp
106 .body
107 ;;
108 ld8 loc2 = [loc2]
109 mov out1 = in1
110 mov out2 = in2
111 mov out3 = in3
112 mov loc3 = psr
113 ;;
114 rsm psr.i
115 mov b7 = loc2
116 ;;
117 br.call.sptk.many rp=b7
118.ret0: mov psr.l = loc3
119 mov ar.pfs = loc1
120 mov rp = loc0
121 ;;
122 srlz.d
123 br.ret.sptk.many b0
124END(ia64_pal_call_stacked)
125
126
127
128
129
130
131
132
133
134
135
136#define PAL_PSR_BITS_TO_CLEAR \
137 (IA64_PSR_I | IA64_PSR_IT | IA64_PSR_DT | IA64_PSR_DB | IA64_PSR_RT |\
138 IA64_PSR_DD | IA64_PSR_SS | IA64_PSR_RI | IA64_PSR_ED | \
139 IA64_PSR_DFL | IA64_PSR_DFH)
140
141#define PAL_PSR_BITS_TO_SET \
142 (IA64_PSR_BN)
143
144
145GLOBAL_ENTRY(ia64_pal_call_phys_static)
146 .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(4)
147 alloc loc1 = ar.pfs,4,7,0,0
148 movl loc2 = pal_entry_point
1491: {
150 mov r28 = in0
151 mov r8 = ip
152 mov loc0 = rp
153 }
154 .body
155 ;;
156 ld8 loc2 = [loc2]
157 mov r29 = in1
158 mov r30 = in2
159 mov r31 = in3
160 ;;
161 mov loc3 = psr
162 adds r8 = 1f-1b,r8
163 ;;
164 mov loc4=ar.rsc
165 dep.z loc2=loc2,0,61
166 tpa r8=r8
167 ;;
168 mov b7 = loc2
169 mov ar.rsc=0
170 movl r16=PAL_PSR_BITS_TO_CLEAR
171 movl r17=PAL_PSR_BITS_TO_SET
172 ;;
173 or loc3=loc3,r17
174 ;;
175 andcm r16=loc3,r16
176 br.call.sptk.many rp=ia64_switch_mode_phys
177 mov rp = r8
178 mov loc5 = r19
179 mov loc6 = r20
180 br.cond.sptk.many b7
1811:
182 mov ar.rsc=0
183 mov r16=loc3
184 mov r19=loc5
185 mov r20=loc6
186 br.call.sptk.many rp=ia64_switch_mode_virt
187 mov psr.l = loc3
188
189 mov ar.pfs = loc1
190 mov rp = loc0
191 ;;
192 mov ar.rsc=loc4
193 srlz.d
194 br.ret.sptk.many b0
195END(ia64_pal_call_phys_static)
196
197
198
199
200
201
202
203
204GLOBAL_ENTRY(ia64_pal_call_phys_stacked)
205 .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(5)
206 alloc loc1 = ar.pfs,5,7,4,0
207 movl loc2 = pal_entry_point
2081: {
209 mov r28 = in0
210 mov loc0 = rp
211 }
212 .body
213 ;;
214 ld8 loc2 = [loc2]
215 mov loc3 = psr
216 ;;
217 mov loc4=ar.rsc
218 dep.z loc2=loc2,0,61
219 ;;
220 mov ar.rsc=0
221 movl r16=PAL_PSR_BITS_TO_CLEAR
222 movl r17=PAL_PSR_BITS_TO_SET
223 ;;
224 or loc3=loc3,r17
225 mov b7 = loc2
226 ;;
227 andcm r16=loc3,r16
228 br.call.sptk.many rp=ia64_switch_mode_phys
229
230 mov out0 = in0
231 mov out1 = in1
232 mov out2 = in2
233 mov out3 = in3
234 mov loc5 = r19
235 mov loc6 = r20
236
237 br.call.sptk.many rp=b7
238
239 mov ar.rsc=0
240 mov r16=loc3
241 mov r19=loc5
242 mov r20=loc6
243 br.call.sptk.many rp=ia64_switch_mode_virt
244
245 mov psr.l = loc3
246 mov ar.pfs = loc1
247 mov rp = loc0
248 ;;
249 mov ar.rsc=loc4
250 srlz.d
251 br.ret.sptk.many b0
252END(ia64_pal_call_phys_stacked)
253
254
255
256
257
258
259
260
261
262
263
264GLOBAL_ENTRY(ia64_save_scratch_fpregs)
265 alloc r3=ar.pfs,1,0,0,0
266 add r2=16,in0
267 ;;
268 stf.spill [in0] = f10,32
269 stf.spill [r2] = f11,32
270 ;;
271 stf.spill [in0] = f12,32
272 stf.spill [r2] = f13,32
273 ;;
274 stf.spill [in0] = f14,32
275 stf.spill [r2] = f15,32
276 br.ret.sptk.many rp
277END(ia64_save_scratch_fpregs)
278
279
280
281
282
283
284
285GLOBAL_ENTRY(ia64_load_scratch_fpregs)
286 alloc r3=ar.pfs,1,0,0,0
287 add r2=16,in0
288 ;;
289 ldf.fill f10 = [in0],32
290 ldf.fill f11 = [r2],32
291 ;;
292 ldf.fill f12 = [in0],32
293 ldf.fill f13 = [r2],32
294 ;;
295 ldf.fill f14 = [in0],32
296 ldf.fill f15 = [r2],32
297 br.ret.sptk.many rp
298END(ia64_load_scratch_fpregs)
299