74 |
/* on your architecture. Run the test_setjmp program to see whether */ |
/* on your architecture. Run the test_setjmp program to see whether */ |
75 |
/* there is any chance it will work. */ |
/* there is any chance it will work. */ |
76 |
|
|
77 |
#ifndef USE_GENERIC_PUSH_REGS |
#if !defined(USE_GENERIC_PUSH_REGS) && !defined(USE_ASM_PUSH_REGS) |
78 |
|
#undef HAVE_PUSH_REGS |
79 |
void GC_push_regs() |
void GC_push_regs() |
80 |
{ |
{ |
81 |
# ifdef RT |
# ifdef RT |
92 |
asm("pushl r8"); asm("calls $1,_GC_push_one"); |
asm("pushl r8"); asm("calls $1,_GC_push_one"); |
93 |
asm("pushl r7"); asm("calls $1,_GC_push_one"); |
asm("pushl r7"); asm("calls $1,_GC_push_one"); |
94 |
asm("pushl r6"); asm("calls $1,_GC_push_one"); |
asm("pushl r6"); asm("calls $1,_GC_push_one"); |
95 |
|
# define HAVE_PUSH_REGS |
96 |
# endif |
# endif |
97 |
# if defined(M68K) && (defined(SUNOS4) || defined(NEXT)) |
# if defined(M68K) && (defined(SUNOS4) || defined(NEXT)) |
98 |
/* M68K SUNOS - could be replaced by generic code */ |
/* M68K SUNOS - could be replaced by generic code */ |
115 |
asm("movl d7,sp@"); asm("jbsr _GC_push_one"); |
asm("movl d7,sp@"); asm("jbsr _GC_push_one"); |
116 |
|
|
117 |
asm("addqw #0x4,sp"); /* put stack back where it was */ |
asm("addqw #0x4,sp"); /* put stack back where it was */ |
118 |
|
# define HAVE_PUSH_REGS |
119 |
# endif |
# endif |
120 |
|
|
121 |
# if defined(M68K) && defined(HP) |
# if defined(M68K) && defined(HP) |
138 |
asm("mov.l %d7,(%sp)"); asm("jsr _GC_push_one"); |
asm("mov.l %d7,(%sp)"); asm("jsr _GC_push_one"); |
139 |
|
|
140 |
asm("addq.w &0x4,%sp"); /* put stack back where it was */ |
asm("addq.w &0x4,%sp"); /* put stack back where it was */ |
141 |
|
# define HAVE_PUSH_REGS |
142 |
# endif /* M68K HP */ |
# endif /* M68K HP */ |
143 |
|
|
144 |
# if defined(M68K) && defined(AMIGA) |
# if defined(M68K) && defined(AMIGA) |
162 |
asm("mov.l %d7,(%sp)"); asm("jsr _GC_push_one"); |
asm("mov.l %d7,(%sp)"); asm("jsr _GC_push_one"); |
163 |
|
|
164 |
asm("addq.w &0x4,%sp"); /* put stack back where it was */ |
asm("addq.w &0x4,%sp"); /* put stack back where it was */ |
165 |
|
# define HAVE_PUSH_REGS |
166 |
# else /* !__GNUC__ */ |
# else /* !__GNUC__ */ |
167 |
GC_push_one(getreg(REG_A2)); |
GC_push_one(getreg(REG_A2)); |
168 |
GC_push_one(getreg(REG_A3)); |
GC_push_one(getreg(REG_A3)); |
179 |
GC_push_one(getreg(REG_D5)); |
GC_push_one(getreg(REG_D5)); |
180 |
GC_push_one(getreg(REG_D6)); |
GC_push_one(getreg(REG_D6)); |
181 |
GC_push_one(getreg(REG_D7)); |
GC_push_one(getreg(REG_D7)); |
182 |
|
# define HAVE_PUSH_REGS |
183 |
# endif /* !__GNUC__ */ |
# endif /* !__GNUC__ */ |
184 |
# endif /* AMIGA */ |
# endif /* AMIGA */ |
185 |
|
|
202 |
PushMacReg(d7); |
PushMacReg(d7); |
203 |
add.w #4,sp ; fix stack. |
add.w #4,sp ; fix stack. |
204 |
} |
} |
205 |
|
# define HAVE_PUSH_REGS |
206 |
# undef PushMacReg |
# undef PushMacReg |
207 |
# endif /* THINK_C */ |
# endif /* THINK_C */ |
208 |
# if defined(__MWERKS__) |
# if defined(__MWERKS__) |
209 |
PushMacRegisters(); |
PushMacRegisters(); |
210 |
|
# define HAVE_PUSH_REGS |
211 |
# endif /* __MWERKS__ */ |
# endif /* __MWERKS__ */ |
212 |
# endif /* MACOS */ |
# endif /* MACOS */ |
213 |
|
|
230 |
asm("pushl %esi"); asm("call _GC_push_one"); asm("addl $4,%esp"); |
asm("pushl %esi"); asm("call _GC_push_one"); asm("addl $4,%esp"); |
231 |
asm("pushl %edi"); asm("call _GC_push_one"); asm("addl $4,%esp"); |
asm("pushl %edi"); asm("call _GC_push_one"); asm("addl $4,%esp"); |
232 |
asm("pushl %ebx"); asm("call _GC_push_one"); asm("addl $4,%esp"); |
asm("pushl %ebx"); asm("call _GC_push_one"); asm("addl $4,%esp"); |
233 |
|
# define HAVE_PUSH_REGS |
234 |
# endif |
# endif |
235 |
|
|
236 |
# if ( defined(I386) && defined(LINUX) && defined(__ELF__) ) \ |
# if ( defined(I386) && defined(LINUX) && defined(__ELF__) ) \ |
253 |
asm("pushl %esi; call GC_push_one; addl $4,%esp"); |
asm("pushl %esi; call GC_push_one; addl $4,%esp"); |
254 |
asm("pushl %edi; call GC_push_one; addl $4,%esp"); |
asm("pushl %edi; call GC_push_one; addl $4,%esp"); |
255 |
asm("pushl %ebx; call GC_push_one; addl $4,%esp"); |
asm("pushl %ebx; call GC_push_one; addl $4,%esp"); |
256 |
|
# define HAVE_PUSH_REGS |
257 |
# endif |
# endif |
258 |
|
|
259 |
# if ( defined(I386) && defined(BEOS) && defined(__ELF__) ) |
# if ( defined(I386) && defined(BEOS) && defined(__ELF__) ) |
265 |
asm("pushl %esi; call GC_push_one; addl $4,%esp"); |
asm("pushl %esi; call GC_push_one; addl $4,%esp"); |
266 |
asm("pushl %edi; call GC_push_one; addl $4,%esp"); |
asm("pushl %edi; call GC_push_one; addl $4,%esp"); |
267 |
asm("pushl %ebx; call GC_push_one; addl $4,%esp"); |
asm("pushl %ebx; call GC_push_one; addl $4,%esp"); |
268 |
|
# define HAVE_PUSH_REGS |
269 |
# endif |
# endif |
270 |
|
|
271 |
# if defined(I386) && defined(MSWIN32) && !defined(__MINGW32__) \ |
# if defined(I386) && defined(MSWIN32) && !defined(__MINGW32__) \ |
292 |
__asm push edi |
__asm push edi |
293 |
__asm call GC_push_one |
__asm call GC_push_one |
294 |
__asm add esp,4 |
__asm add esp,4 |
295 |
|
# define HAVE_PUSH_REGS |
296 |
# endif |
# endif |
297 |
|
|
298 |
# if defined(I386) && (defined(SVR4) || defined(SCO) || defined(SCO_ELF)) |
# if defined(I386) && (defined(SVR4) || defined(SCO) || defined(SCO_ELF)) |
304 |
asm("pushl %ebp"); asm("call GC_push_one"); asm("addl $4,%esp"); |
asm("pushl %ebp"); asm("call GC_push_one"); asm("addl $4,%esp"); |
305 |
asm("pushl %esi"); asm("call GC_push_one"); asm("addl $4,%esp"); |
asm("pushl %esi"); asm("call GC_push_one"); asm("addl $4,%esp"); |
306 |
asm("pushl %edi"); asm("call GC_push_one"); asm("addl $4,%esp"); |
asm("pushl %edi"); asm("call GC_push_one"); asm("addl $4,%esp"); |
307 |
|
# define HAVE_PUSH_REGS |
308 |
# endif |
# endif |
309 |
|
|
310 |
# ifdef NS32K |
# ifdef NS32K |
313 |
asm ("movd r5, tos"); asm ("bsr ?_GC_push_one"); asm ("adjspb $-4"); |
asm ("movd r5, tos"); asm ("bsr ?_GC_push_one"); asm ("adjspb $-4"); |
314 |
asm ("movd r6, tos"); asm ("bsr ?_GC_push_one"); asm ("adjspb $-4"); |
asm ("movd r6, tos"); asm ("bsr ?_GC_push_one"); asm ("adjspb $-4"); |
315 |
asm ("movd r7, tos"); asm ("bsr ?_GC_push_one"); asm ("adjspb $-4"); |
asm ("movd r7, tos"); asm ("bsr ?_GC_push_one"); asm ("adjspb $-4"); |
316 |
|
# define HAVE_PUSH_REGS |
317 |
# endif |
# endif |
318 |
|
|
319 |
# if defined(SPARC) |
# if defined(SPARC) |
320 |
{ |
GC_save_regs_ret_val = GC_save_regs_in_stack(); |
321 |
word GC_save_regs_in_stack(); |
# define HAVE_PUSH_REGS |
|
|
|
|
GC_save_regs_ret_val = GC_save_regs_in_stack(); |
|
|
} |
|
322 |
# endif |
# endif |
323 |
|
|
324 |
# ifdef RT |
# ifdef RT |
334 |
asm("cas r11, r13, r0"); GC_push_one(TMP_SP); /* through */ |
asm("cas r11, r13, r0"); GC_push_one(TMP_SP); /* through */ |
335 |
asm("cas r11, r14, r0"); GC_push_one(TMP_SP); /* r15 */ |
asm("cas r11, r14, r0"); GC_push_one(TMP_SP); /* r15 */ |
336 |
asm("cas r11, r15, r0"); GC_push_one(TMP_SP); |
asm("cas r11, r15, r0"); GC_push_one(TMP_SP); |
337 |
|
# define HAVE_PUSH_REGS |
338 |
# endif |
# endif |
339 |
|
|
340 |
# if defined(M68K) && defined(SYSV) |
# if defined(M68K) && defined(SYSV) |
358 |
asm("movl %d7,%sp@"); asm("jbsr GC_push_one"); |
asm("movl %d7,%sp@"); asm("jbsr GC_push_one"); |
359 |
|
|
360 |
asm("addqw #0x4,%sp"); /* put stack back where it was */ |
asm("addqw #0x4,%sp"); /* put stack back where it was */ |
361 |
|
# define HAVE_PUSH_REGS |
362 |
# else /* !__GNUC__*/ |
# else /* !__GNUC__*/ |
363 |
asm("subq.w &0x4,%sp"); /* allocate word on top of stack */ |
asm("subq.w &0x4,%sp"); /* allocate word on top of stack */ |
364 |
|
|
376 |
asm("mov.l %d7,(%sp)"); asm("jsr GC_push_one"); |
asm("mov.l %d7,(%sp)"); asm("jsr GC_push_one"); |
377 |
|
|
378 |
asm("addq.w &0x4,%sp"); /* put stack back where it was */ |
asm("addq.w &0x4,%sp"); /* put stack back where it was */ |
379 |
|
# define HAVE_PUSH_REGS |
380 |
# endif /* !__GNUC__ */ |
# endif /* !__GNUC__ */ |
381 |
# endif /* M68K/SYSV */ |
# endif /* M68K/SYSV */ |
382 |
|
|
386 |
extern int *__libc_stack_end; |
extern int *__libc_stack_end; |
387 |
|
|
388 |
GC_push_all_stack (sp, __libc_stack_end); |
GC_push_all_stack (sp, __libc_stack_end); |
389 |
|
# define HAVE_PUSH_REGS |
390 |
|
/* Isn't this redundant with the code to push the stack? */ |
391 |
} |
} |
392 |
# endif |
# endif |
393 |
|
|
394 |
/* other machines... */ |
/* other machines... */ |
395 |
# if !defined(M68K) && !defined(VAX) && !defined(RT) |
# if !defined(HAVE_PUSH_REGS) |
396 |
# if !defined(SPARC) && !defined(I386) && !defined(NS32K) |
--> We just generated an empty GC_push_regs, which |
397 |
# if !defined(POWERPC) && !defined(UTS4) |
--> is almost certainly broken. Try defining |
398 |
# if !defined(PJ) && !(defined(MIPS) && defined(LINUX)) |
--> USE_GENERIC_PUSH_REGS instead. |
|
--> bad news <-- |
|
|
# endif |
|
|
# endif |
|
|
# endif |
|
399 |
# endif |
# endif |
400 |
} |
} |
401 |
#endif /* !USE_GENERIC_PUSH_REGS */ |
#endif /* !USE_GENERIC_PUSH_REGS && !USE_ASM_PUSH_REGS */ |
402 |
|
|
403 |
#if defined(USE_GENERIC_PUSH_REGS) |
#if defined(USE_GENERIC_PUSH_REGS) |
404 |
void GC_generic_push_regs(cold_gc_frame) |
void GC_generic_push_regs(cold_gc_frame) |
440 |
/* needed on IA64, since some non-windowed registers are */ |
/* needed on IA64, since some non-windowed registers are */ |
441 |
/* preserved. */ |
/* preserved. */ |
442 |
{ |
{ |
|
word GC_save_regs_in_stack(); |
|
|
|
|
443 |
GC_save_regs_ret_val = GC_save_regs_in_stack(); |
GC_save_regs_ret_val = GC_save_regs_in_stack(); |
444 |
/* On IA64 gcc, could use __builtin_ia64_flushrs() and */ |
/* On IA64 gcc, could use __builtin_ia64_flushrs() and */ |
445 |
/* __builtin_ia64_flushrs(). The latter will be done */ |
/* __builtin_ia64_flushrs(). The latter will be done */ |
456 |
/* the stack. Return sp. */ |
/* the stack. Return sp. */ |
457 |
# ifdef SPARC |
# ifdef SPARC |
458 |
asm(" .seg \"text\""); |
asm(" .seg \"text\""); |
459 |
# ifdef SVR4 |
# if defined(SVR4) || defined(NETBSD) |
460 |
asm(" .globl GC_save_regs_in_stack"); |
asm(" .globl GC_save_regs_in_stack"); |
461 |
asm("GC_save_regs_in_stack:"); |
asm("GC_save_regs_in_stack:"); |
462 |
asm(" .type GC_save_regs_in_stack,#function"); |
asm(" .type GC_save_regs_in_stack,#function"); |