2 * Copyright (c) 2003 Marcel Moolenaar
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 #include <machine/asm.h>
28 __FBSDID("$FreeBSD$");
30 #include <sys/syscall.h>
32 #define SIZEOF_SPECIAL (18*8)
35 * int _ia64_restore_context(mcontext_t *mc, intptr_t val, intptr_t *loc);
37 ENTRY(_ia64_restore_context, 3)
51 ld8 r16=[r31],16 // unat (before)
53 add r14=SIZEOF_SPECIAL,r32
57 ld8 r17=[r30],16 // rp
58 ld8 r18=[r31],16 // pr
63 ld8 r19=[r30],16 // pfs
64 ld8 r20=[r31],32 // bspstore
69 ld8 r21=[r30],32 // rnat
70 ld8 r22=[r31],16 // rsc
76 ld8 r24=[r31] // psr -- not used
81 ld8 r17=[r14],8 // unat (after)
93 ld8.fill r4=[r14],16 // r4
94 ld8.fill r5=[r15],16 // r5
99 ld8.fill r6=[r14],16 // r6
100 ld8.fill r7=[r15],16 // r7
110 ld8 r17=[r14],16 // b1
111 ld8 r18=[r15],16 // b2
116 ld8 r19=[r14],16 // b3
117 ld8 r20=[r15],16 // b4
122 ld8 r16=[r14],24 // b5
123 ld8 r17=[r15],32 // lc
140 ldf.fill f16=[r14],32
141 ldf.fill f17=[r15],32
146 ldf.fill f18=[r14],32
147 ldf.fill f19=[r15],32
151 ldf.fill f20=[r14],32
152 ldf.fill f21=[r15],32
154 ldf.fill f22=[r14],32
155 ldf.fill f23=[r15],32
157 ldf.fill f24=[r14],32
158 ldf.fill f25=[r15],32
160 ldf.fill f26=[r14],32
161 ldf.fill f27=[r15],32
163 ldf.fill f28=[r14],32
164 ldf.fill f29=[r15],32
166 ldf.fill f30=[r14],32+24
167 ldf.fill f31=[r15],24+24
181 END(_ia64_restore_context)
184 * int _ia64_save_context(mcontext_t *mc);
186 ENTRY(_ia64_save_context, 1)
207 st8 [r32]=sp,16 // sp
212 st8 [r31]=r16,16 // unat (before)
213 st8 [r32]=r17,16 // rp
218 st8 [r31]=r16,16 // pr
224 st8 [r32]=r16,16 // pfs
225 st8 [r31]=r17,16 // bspstore
232 add r30=SIZEOF_SPECIAL-(6*8),r32
236 st8 [r32]=r16,16 // rnat
237 st8 [r31]=r0,16 // __spare
242 st8 [r32]=r13,16 // tp -- not used
243 st8 [r31]=r14,16 // rsc
248 st8 [r32]=r15,10*8 // fpr
249 st8 [r31]=r0,8*8 // psr
256 st8.spill [r31]=r4,16 // r4
258 st8.spill [r32]=r5,16 // r5
264 st8.spill [r31]=r6,16 // r6
266 st8.spill [r32]=r7,16 // r7
271 st8 [r31]=r16,16 // b1
277 st8 [r30]=r16 // unat (after)
278 st8 [r32]=r17,16 // b2
283 st8 [r31]=r18,16 // b3
284 st8 [r32]=r19,16 // b4
288 st8 [r31]=r16,16 // b5
289 st8 [r32]=r17,16 // lc
291 st8 [r31]=r0,24 // __spare
292 stf.spill [r32]=f2,32
294 stf.spill [r31]=f3,32
295 stf.spill [r32]=f4,32
297 stf.spill [r31]=f5,32
298 stf.spill [r32]=f16,32
300 stf.spill [r31]=f17,32
301 stf.spill [r32]=f18,32
303 stf.spill [r31]=f19,32
304 stf.spill [r32]=f20,32
306 stf.spill [r31]=f21,32
307 stf.spill [r32]=f22,32
309 stf.spill [r31]=f23,32
310 stf.spill [r32]=f24,32
312 stf.spill [r31]=f25,32
313 stf.spill [r32]=f26,32
315 stf.spill [r31]=f27,32
316 stf.spill [r32]=f28,32
319 stf.spill [r31]=f29,32
320 stf.spill [r32]=f30,32+24
325 stf.spill [r31]=f31,24+24
326 st8 [r32]=r14,16 // r8
330 st8 [r31]=r0,16 // r9
339 END(_ia64_save_context)
342 * void _ia64_break_setcontext(mcontext_t *mc);
344 ENTRY(_ia64_break_setcontext, 1)
351 END(_ia64_break_setcontext)