4 ****************************************************************************
5 * Copyright IBM Corporation 1988, 1989 - All Rights Reserved *
7 * Permission to use, copy, modify, and distribute this software and its *
8 * documentation for any purpose and without fee is hereby granted, *
9 * provided that the above copyright notice appear in all copies and *
10 * that both that copyright notice and this permission notice appear in *
11 * supporting documentation, and that the name of IBM not be used in *
12 * advertising or publicity pertaining to distribution of the software *
13 * without specific, written prior permission. *
15 * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL *
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL IBM *
17 * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY *
18 * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER *
19 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING *
20 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *
21 ****************************************************************************
31 #if defined(HAVE_MACHINE_REGDEF_H)
32 #include <machine/regdef.h>
33 #elif defined(HAVE_REGDEF_H)
37 /* 9 sregs, ra, 6 fp regs, gp, pad to 8 byte boundary */
38 #define regspace 9 * 4 + 4 + 6 * 8 + 4 + 4
40 #define registers floats + 6 * 8
41 #define returnaddr regspace - 4
43 #define GPOFF regspace - 8
44 .globl savecontext /* MIPS' C compiler doesnt prepend underscores. */
45 .ent savecontext /* Insert debugger information. */
48 .cpload t9 # set up gp for KPIC
51 .cprestore GPOFF # trigger t9/jalr
57 .frame sp, regspace, ra
59 sw s0, registers + 0(sp)
60 sw s1, registers + 4(sp)
61 sw s2, registers + 8(sp)
62 sw s3, registers + 12(sp)
63 sw s4, registers + 16(sp)
64 sw s5, registers + 20(sp)
65 sw s6, registers + 24(sp)
66 sw s7, registers + 28(sp)
67 sw s8, registers + 32(sp)
68 /* Save return address */
71 /* Need to save floating point registers? */
72 s.d $f20, floats + 0(sp)
73 s.d $f22, floats + 8(sp)
74 s.d $f24, floats + 16(sp)
75 s.d $f26, floats + 24(sp)
76 s.d $f28, floats + 32(sp)
77 s.d $f30, floats + 40(sp)
78 .fmask 0x55400000, regspace
91 .cpload t9 # set up gp for KPIC
95 lw s0, registers + 0(sp)
96 lw s1, registers + 4(sp)
97 lw s2, registers + 8(sp)
98 lw s3, registers + 12(sp)
99 lw s4, registers + 16(sp)
100 lw s5, registers + 20(sp)
101 lw s6, registers + 24(sp)
102 lw s7, registers + 28(sp)
103 lw s8, registers + 32(sp)
104 /* Save return address */
105 lw ra, returnaddr(sp)
106 /* Need to save floating point registers? */
107 l.d $f20, floats + 0(sp)
108 l.d $f22, floats + 8(sp)
109 l.d $f24, floats + 16(sp)
110 l.d $f26, floats + 24(sp)
111 l.d $f28, floats + 32(sp)
112 l.d $f30, floats + 40(sp)
122 /* Code for MIPS R2000/R3000 architecture
123 * Written by Zalman Stern April 30th, 1989.
126 #if defined(HAVE_REGDEF_H)
127 #include <regdef.h> /* Allow use of symbolic names for registers. */
146 #define regspace 9 * 4 + 4 + 6 * 8
148 #define registers floats + 6 * 8
149 #define returnaddr regspace - 4
151 .globl savecontext /* MIPS' C compiler doesnt prepend underscores. */
152 .ent savecontext /* Insert debugger information. */
158 .frame sp, regspace, ra
159 /* Save registers. */
160 sw s0, registers + 0(sp)
161 sw s1, registers + 4(sp)
162 sw s2, registers + 8(sp)
163 sw s3, registers + 12(sp)
164 sw s4, registers + 16(sp)
165 sw s5, registers + 20(sp)
166 sw s6, registers + 24(sp)
167 sw s7, registers + 28(sp)
168 sw s8, registers + 32(sp)
169 /* Save return address */
170 sw ra, returnaddr(sp)
172 /* Need to save floating point registers? */
173 s.d $f20, floats + 0(sp)
174 s.d $f22, floats + 8(sp)
175 s.d $f24, floats + 16(sp)
176 s.d $f26, floats + 24(sp)
177 s.d $f28, floats + 32(sp)
178 s.d $f30, floats + 40(sp)
179 .fmask 0x55400000, regspace
181 beq a2, $0, samestack
191 lw s0, registers + 0(sp)
192 lw s1, registers + 4(sp)
193 lw s2, registers + 8(sp)
194 lw s3, registers + 12(sp)
195 lw s4, registers + 16(sp)
196 lw s5, registers + 20(sp)
197 lw s6, registers + 24(sp)
198 lw s7, registers + 28(sp)
199 lw s8, registers + 32(sp)
200 /* Save return address */
201 lw ra, returnaddr(sp)
202 /* Need to save floating point registers? */
203 l.d $f20, floats + 0(sp)
204 l.d $f22, floats + 8(sp)
205 l.d $f24, floats + 16(sp)
206 l.d $f26, floats + 24(sp)
207 l.d $f28, floats + 32(sp)
208 l.d $f30, floats + 40(sp)
213 #endif /* HAVE_PIC */