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 ****************************************************************************
28 /* Code for DEC Alpha architecture */
30 #include <machine/asm.h>
31 #include <machine/regdef.h>
87 #define M_S0 0x00000200
88 #define M_S1 0x00000400
89 #define M_S2 0x00000800
90 #define M_S3 0x00001000
91 #define M_S4 0x00002000
92 #define M_S5 0x00004000
93 #define M_S6 0x00008000
95 #define M_RA 0x04000000
100 #define NESTED(x, fsize, rpc) \
113 #define IMPORT(sym, size) \
115 #elif defined(HAVE_MACHINE_ASM_H) /* BSD */
116 #include <machine/asm.h>
117 #elif defined(HAVE_MACH_ALPHA_ASM_H) /* OSF */
118 #include <mach/alpha/asm.h>
121 #define FRAMESIZE ((8*8)+8+(7*8))
123 #define registers (floats+(8*8))
124 #define returnaddr (FRAMESIZE-8)
127 #if defined(AFS_OSF_ENV) || defined(AFS_LINUX_ENV)
131 #if defined(AFS_OSF_ENV) || defined(AFS_LINUX_ENV)
132 NESTED(savecontext,FRAMESIZE,ra)
133 #else /* OSF || LINUX */
134 NESTED(savecontext,3,FRAMESIZE,ra,0x0400f700,0x000003fc)
139 lda sp,-FRAMESIZE(sp)
140 /* Save callee-saved registers. */
141 stq s0, (registers+0) (sp)
142 stq s1, (registers+8) (sp)
143 stq s2, (registers+16) (sp)
144 stq s3, (registers+24) (sp)
145 stq s4, (registers+32) (sp)
146 stq s5, (registers+40) (sp)
147 stq s6, (registers+48) (sp)
148 /* Save return address */
149 stq ra, returnaddr(sp)
151 #if !defined(AFS_BSD_ENV)
152 .mask (M_S0|M_S1|M_S2|M_S3|M_S4|M_S5|M_S6|M_RA), -FRAMESIZE
155 /* Save floating point registers */
156 stt fs0, (floats+0) (sp)
157 stt fs1, (floats+8) (sp)
158 stt fs2, (floats+16) (sp)
159 stt fs3, (floats+24) (sp)
160 stt fs4, (floats+32) (sp)
161 stt fs5, (floats+40) (sp)
162 stt fs6, (floats+48) (sp)
163 stt fs7, (floats+56) (sp)
167 or a0,zero,pv /* call point in pv */
169 or a2,zero,sp /* switch stack */
171 jsr ra,(pv),0 /* off we go */
174 #if defined(AFS_OSF_ENV) || defined(AFS_LINUX_ENV)
183 /* Restore callee-saved regs */
184 ldq s0, (registers+0) (sp)
185 ldq s1, (registers+8) (sp)
186 ldq s2, (registers+16) (sp)
187 ldq s3, (registers+24) (sp)
188 ldq s4, (registers+32) (sp)
189 ldq s5, (registers+40) (sp)
190 ldq s6, (registers+48) (sp)
192 ldq ra, returnaddr(sp)
193 /* Floating point registers */
194 ldt fs0, (floats+0) (sp)
195 ldt fs1, (floats+8) (sp)
196 ldt fs2, (floats+16) (sp)
197 ldt fs3, (floats+24) (sp)
198 ldt fs4, (floats+32) (sp)
199 ldt fs5, (floats+40) (sp)
200 ldt fs6, (floats+48) (sp)
201 ldt fs7, (floats+56) (sp)
202 lda sp, FRAMESIZE(sp)