OSDN Git Service

* c-decl.c (get_parm_info): Use INTEGRAL_TYPE_P.
[pf3gnuchains/gcc-fork.git] / boehm-gc / mach_dep.c
1 /* 
2  * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
3  * Copyright (c) 1991-1994 by Xerox Corporation.  All rights reserved.
4  *
5  * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
6  * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
7  *
8  * Permission is hereby granted to use or copy this program
9  * for any purpose,  provided the above notices are retained on all copies.
10  * Permission to modify the code and to distribute modified code is granted,
11  * provided the above notices are retained, and a notice that the code was
12  * modified is included with the above copyright notice.
13  */
14 /* Boehm, November 17, 1995 12:13 pm PST */
15 # include "private/gc_priv.h"
16 # include <stdio.h>
17 # include <setjmp.h>
18 # if defined(OS2) || defined(CX_UX)
19 #   define _setjmp(b) setjmp(b)
20 #   define _longjmp(b,v) longjmp(b,v)
21 # endif
22 # ifdef AMIGA
23 #   ifndef __GNUC__
24 #     include <dos.h>
25 #   else
26 #     include <machine/reg.h>
27 #   endif
28 # endif
29
30 #if defined(__MWERKS__) && !defined(POWERPC)
31
32 asm static void PushMacRegisters()
33 {
34     sub.w   #4,sp                   // reserve space for one parameter.
35     move.l  a2,(sp)
36     jsr         GC_push_one
37     move.l  a3,(sp)
38     jsr         GC_push_one
39     move.l  a4,(sp)
40     jsr         GC_push_one
41 #   if !__option(a6frames)
42         // <pcb> perhaps a6 should be pushed if stack frames are not being used.    
43         move.l  a6,(sp)
44         jsr             GC_push_one
45 #   endif
46         // skip a5 (globals), a6 (frame pointer), and a7 (stack pointer)
47     move.l  d2,(sp)
48     jsr         GC_push_one
49     move.l  d3,(sp)
50     jsr         GC_push_one
51     move.l  d4,(sp)
52     jsr         GC_push_one
53     move.l  d5,(sp)
54     jsr         GC_push_one
55     move.l  d6,(sp)
56     jsr         GC_push_one
57     move.l  d7,(sp)
58     jsr         GC_push_one
59     add.w   #4,sp                   // fix stack.
60     rts
61 }
62
63 #endif /* __MWERKS__ */
64
65 # if defined(SPARC) || defined(IA64)
66     /* Value returned from register flushing routine; either sp (SPARC) */
67     /* or ar.bsp (IA64)                                                 */
68     word GC_save_regs_ret_val;
69 # endif
70
71 /* Routine to mark from registers that are preserved by the C compiler. */
72 /* This must be ported to every new architecture.  There is a generic   */
73 /* version at the end, that is likely, but not guaranteed to work       */
74 /* on your architecture.  Run the test_setjmp program to see whether    */
75 /* there is any chance it will work.                                    */
76
77 #ifndef USE_GENERIC_PUSH_REGS
78 void GC_push_regs()
79 {
80 #       ifdef RT
81           register long TMP_SP; /* must be bound to r11 */
82 #       endif
83
84 #       if defined(MIPS) && defined(LINUX)
85           /* I'm not sure whether this has actually been tested. */
86 #         define call_push(x)     asm("move $4," x ";"); asm("jal GC_push_one")
87           call_push("$2");
88           call_push("$3");
89           call_push("$16");
90           call_push("$17");
91           call_push("$18");
92           call_push("$19");
93           call_push("$20");
94           call_push("$21");
95           call_push("$22");
96           call_push("$23");
97           call_push("$30");
98 #         undef call_push
99 #       endif   /* MIPS && LINUX */
100
101 #       ifdef VAX
102           /* VAX - generic code below does not work under 4.2 */
103           /* r1 through r5 are caller save, and therefore     */
104           /* on the stack or dead.                            */
105           asm("pushl r11");     asm("calls $1,_GC_push_one");
106           asm("pushl r10");     asm("calls $1,_GC_push_one");
107           asm("pushl r9");      asm("calls $1,_GC_push_one");
108           asm("pushl r8");      asm("calls $1,_GC_push_one");
109           asm("pushl r7");      asm("calls $1,_GC_push_one");
110           asm("pushl r6");      asm("calls $1,_GC_push_one");
111 #       endif
112 #       if defined(M68K) && (defined(SUNOS4) || defined(NEXT))
113         /*  M68K SUNOS - could be replaced by generic code */
114           /* a0, a1 and d1 are caller save          */
115           /*  and therefore are on stack or dead.   */
116         
117           asm("subqw #0x4,sp");         /* allocate word on top of stack */
118
119           asm("movl a2,sp@");   asm("jbsr _GC_push_one");
120           asm("movl a3,sp@");   asm("jbsr _GC_push_one");
121           asm("movl a4,sp@");   asm("jbsr _GC_push_one");
122           asm("movl a5,sp@");   asm("jbsr _GC_push_one");
123           /* Skip frame pointer and stack pointer */
124           asm("movl d1,sp@");   asm("jbsr _GC_push_one");
125           asm("movl d2,sp@");   asm("jbsr _GC_push_one");
126           asm("movl d3,sp@");   asm("jbsr _GC_push_one");
127           asm("movl d4,sp@");   asm("jbsr _GC_push_one");
128           asm("movl d5,sp@");   asm("jbsr _GC_push_one");
129           asm("movl d6,sp@");   asm("jbsr _GC_push_one");
130           asm("movl d7,sp@");   asm("jbsr _GC_push_one");
131
132           asm("addqw #0x4,sp");         /* put stack back where it was  */
133 #       endif
134
135 #       if defined(M68K) && defined(HP)
136         /*  M68K HP - could be replaced by generic code */
137           /* a0, a1 and d1 are caller save.  */
138         
139           asm("subq.w &0x4,%sp");       /* allocate word on top of stack */
140
141           asm("mov.l %a2,(%sp)"); asm("jsr _GC_push_one");
142           asm("mov.l %a3,(%sp)"); asm("jsr _GC_push_one");
143           asm("mov.l %a4,(%sp)"); asm("jsr _GC_push_one");
144           asm("mov.l %a5,(%sp)"); asm("jsr _GC_push_one");
145           /* Skip frame pointer and stack pointer */
146           asm("mov.l %d1,(%sp)"); asm("jsr _GC_push_one");
147           asm("mov.l %d2,(%sp)"); asm("jsr _GC_push_one");
148           asm("mov.l %d3,(%sp)"); asm("jsr _GC_push_one");
149           asm("mov.l %d4,(%sp)"); asm("jsr _GC_push_one");
150           asm("mov.l %d5,(%sp)"); asm("jsr _GC_push_one");
151           asm("mov.l %d6,(%sp)"); asm("jsr _GC_push_one");
152           asm("mov.l %d7,(%sp)"); asm("jsr _GC_push_one");
153
154           asm("addq.w &0x4,%sp");       /* put stack back where it was  */
155 #       endif /* M68K HP */
156
157 #       if defined(M68K) && defined(AMIGA)
158          /*  AMIGA - could be replaced by generic code                  */
159          /* a0, a1, d0 and d1 are caller save */
160
161 #        ifdef __GNUC__
162           asm("subq.w &0x4,%sp");       /* allocate word on top of stack */
163
164           asm("mov.l %a2,(%sp)"); asm("jsr _GC_push_one");
165           asm("mov.l %a3,(%sp)"); asm("jsr _GC_push_one");
166           asm("mov.l %a4,(%sp)"); asm("jsr _GC_push_one");
167           asm("mov.l %a5,(%sp)"); asm("jsr _GC_push_one");
168           asm("mov.l %a6,(%sp)"); asm("jsr _GC_push_one");
169           /* Skip frame pointer and stack pointer */
170           asm("mov.l %d2,(%sp)"); asm("jsr _GC_push_one");
171           asm("mov.l %d3,(%sp)"); asm("jsr _GC_push_one");
172           asm("mov.l %d4,(%sp)"); asm("jsr _GC_push_one");
173           asm("mov.l %d5,(%sp)"); asm("jsr _GC_push_one");
174           asm("mov.l %d6,(%sp)"); asm("jsr _GC_push_one");
175           asm("mov.l %d7,(%sp)"); asm("jsr _GC_push_one");
176
177           asm("addq.w &0x4,%sp");       /* put stack back where it was  */
178 #        else /* !__GNUC__ */
179           GC_push_one(getreg(REG_A2));
180           GC_push_one(getreg(REG_A3));
181 #         ifndef __SASC
182               /* Can probably be changed to #if 0 -Kjetil M. (a4=globals)*/
183             GC_push_one(getreg(REG_A4));
184 #         endif
185           GC_push_one(getreg(REG_A5));
186           GC_push_one(getreg(REG_A6));
187           /* Skip stack pointer */
188           GC_push_one(getreg(REG_D2));
189           GC_push_one(getreg(REG_D3));
190           GC_push_one(getreg(REG_D4));
191           GC_push_one(getreg(REG_D5));
192           GC_push_one(getreg(REG_D6));
193           GC_push_one(getreg(REG_D7));
194 #        endif /* !__GNUC__ */
195 #       endif /* AMIGA */
196
197 #       if defined(M68K) && defined(MACOS)
198 #       if defined(THINK_C)
199 #         define PushMacReg(reg) \
200               move.l  reg,(sp) \
201               jsr             GC_push_one
202           asm {
203               sub.w   #4,sp                   ; reserve space for one parameter.
204               PushMacReg(a2);
205               PushMacReg(a3);
206               PushMacReg(a4);
207               ; skip a5 (globals), a6 (frame pointer), and a7 (stack pointer)
208               PushMacReg(d2);
209               PushMacReg(d3);
210               PushMacReg(d4);
211               PushMacReg(d5);
212               PushMacReg(d6);
213               PushMacReg(d7);
214               add.w   #4,sp                   ; fix stack.
215           }
216 #         undef PushMacReg
217 #       endif /* THINK_C */
218 #       if defined(__MWERKS__)
219           PushMacRegisters();
220 #       endif   /* __MWERKS__ */
221 #   endif       /* MACOS */
222
223 #       if defined(I386) &&!defined(OS2) &&!defined(SVR4) \
224         && (defined(__MINGW32__) || !defined(MSWIN32)) \
225         && !defined(SCO) && !defined(SCO_ELF) \
226         && !(defined(LINUX) && defined(__ELF__)) \
227         && !(defined(FREEBSD) && defined(__ELF__)) \
228         && !(defined(NETBSD) && defined(__ELF__)) \
229         && !(defined(OPENBSD) && defined(__ELF__)) \
230         && !(defined(BEOS) && defined(__ELF__)) \
231         && !defined(DOS4GW)
232         /* I386 code, generic code does not appear to work */
233         /* It does appear to work under OS2, and asms dont */
234         /* This is used for some 38g UNIX variants and for CYGWIN32 */
235           asm("pushl %eax");  asm("call _GC_push_one"); asm("addl $4,%esp");
236           asm("pushl %ecx");  asm("call _GC_push_one"); asm("addl $4,%esp");
237           asm("pushl %edx");  asm("call _GC_push_one"); asm("addl $4,%esp");
238           asm("pushl %ebp");  asm("call _GC_push_one"); asm("addl $4,%esp");
239           asm("pushl %esi");  asm("call _GC_push_one"); asm("addl $4,%esp");
240           asm("pushl %edi");  asm("call _GC_push_one"); asm("addl $4,%esp");
241           asm("pushl %ebx");  asm("call _GC_push_one"); asm("addl $4,%esp");
242 #       endif
243
244 #       if ( defined(I386) && defined(LINUX) && defined(__ELF__) ) \
245         || ( defined(I386) && defined(FREEBSD) && defined(__ELF__) ) \
246         || ( defined(I386) && defined(NETBSD) && defined(__ELF__) ) \
247         || ( defined(I386) && defined(OPENBSD) && defined(__ELF__) )
248
249         /* This is modified for Linux with ELF (Note: _ELF_ only) */
250         /* This section handles FreeBSD with ELF. */
251         /* Eax is caller-save and dead here.  Other caller-save         */
252         /* registers could also be skipped.  We assume there are no     */
253         /* pointers in MMX registers, etc.                              */
254         /* We combine instructions in a single asm to prevent gcc from  */
255         /* inserting code in the middle.                                */
256           asm("pushl %ecx; call GC_push_one; addl $4,%esp");
257           asm("pushl %edx; call GC_push_one; addl $4,%esp");
258           asm("pushl %ebp; call GC_push_one; addl $4,%esp");
259           asm("pushl %esi; call GC_push_one; addl $4,%esp");
260           asm("pushl %edi; call GC_push_one; addl $4,%esp");
261           asm("pushl %ebx; call GC_push_one; addl $4,%esp");
262 #       endif
263
264 #       if ( defined(I386) && defined(BEOS) && defined(__ELF__) )
265         /* As far as I can understand from                              */
266         /* http://www.beunited.org/articles/jbq/nasm.shtml,             */
267         /* only ebp, esi, edi and ebx are not scratch. How MMX          */
268         /* etc. registers should be treated, I have no idea.            */
269           asm("pushl %ebp; call GC_push_one; addl $4,%esp");
270           asm("pushl %esi; call GC_push_one; addl $4,%esp");
271           asm("pushl %edi; call GC_push_one; addl $4,%esp");
272           asm("pushl %ebx; call GC_push_one; addl $4,%esp");
273 #       endif
274
275 #       if defined(I386) && defined(MSWIN32) && !defined(__MINGW32__) \
276            && !defined(USE_GENERIC)
277         /* I386 code, Microsoft variant         */
278           __asm  push eax
279           __asm  call GC_push_one
280           __asm  add esp,4
281           __asm  push ebx
282           __asm  call GC_push_one
283           __asm  add esp,4
284           __asm  push ecx
285           __asm  call GC_push_one
286           __asm  add esp,4
287           __asm  push edx
288           __asm  call GC_push_one
289           __asm  add esp,4
290           __asm  push ebp
291           __asm  call GC_push_one
292           __asm  add esp,4
293           __asm  push esi
294           __asm  call GC_push_one
295           __asm  add esp,4
296           __asm  push edi
297           __asm  call GC_push_one
298           __asm  add esp,4
299 #       endif
300
301 #       if defined(I386) && (defined(SVR4) || defined(SCO) || defined(SCO_ELF))
302         /* I386 code, SVR4 variant, generic code does not appear to work */
303           asm("pushl %eax");  asm("call GC_push_one"); asm("addl $4,%esp");
304           asm("pushl %ebx");  asm("call GC_push_one"); asm("addl $4,%esp");
305           asm("pushl %ecx");  asm("call GC_push_one"); asm("addl $4,%esp");
306           asm("pushl %edx");  asm("call GC_push_one"); asm("addl $4,%esp");
307           asm("pushl %ebp");  asm("call GC_push_one"); asm("addl $4,%esp");
308           asm("pushl %esi");  asm("call GC_push_one"); asm("addl $4,%esp");
309           asm("pushl %edi");  asm("call GC_push_one"); asm("addl $4,%esp");
310 #       endif
311
312 #       ifdef NS32K
313           asm ("movd r3, tos"); asm ("bsr ?_GC_push_one"); asm ("adjspb $-4");
314           asm ("movd r4, tos"); asm ("bsr ?_GC_push_one"); asm ("adjspb $-4");
315           asm ("movd r5, tos"); asm ("bsr ?_GC_push_one"); asm ("adjspb $-4");
316           asm ("movd r6, tos"); asm ("bsr ?_GC_push_one"); asm ("adjspb $-4");
317           asm ("movd r7, tos"); asm ("bsr ?_GC_push_one"); asm ("adjspb $-4");
318 #       endif
319
320 #       if defined(SPARC)
321           {
322               word GC_save_regs_in_stack();
323               
324               GC_save_regs_ret_val = GC_save_regs_in_stack();
325           }
326 #       endif
327
328 #       ifdef RT
329             GC_push_one(TMP_SP);    /* GC_push_one from r11 */
330
331             asm("cas r11, r6, r0"); GC_push_one(TMP_SP);        /* r6 */
332             asm("cas r11, r7, r0"); GC_push_one(TMP_SP);        /* through */
333             asm("cas r11, r8, r0"); GC_push_one(TMP_SP);        /* r10 */
334             asm("cas r11, r9, r0"); GC_push_one(TMP_SP);
335             asm("cas r11, r10, r0"); GC_push_one(TMP_SP);
336
337             asm("cas r11, r12, r0"); GC_push_one(TMP_SP); /* r12 */
338             asm("cas r11, r13, r0"); GC_push_one(TMP_SP); /* through */
339             asm("cas r11, r14, r0"); GC_push_one(TMP_SP); /* r15 */
340             asm("cas r11, r15, r0"); GC_push_one(TMP_SP);
341 #       endif
342
343 #       if defined(M68K) && defined(SYSV)
344         /*  Once again similar to SUN and HP, though setjmp appears to work.
345                 --Parag
346          */
347 #        ifdef __GNUC__
348           asm("subqw #0x4,%sp");        /* allocate word on top of stack */
349   
350           asm("movl %a2,%sp@"); asm("jbsr GC_push_one");
351           asm("movl %a3,%sp@"); asm("jbsr GC_push_one");
352           asm("movl %a4,%sp@"); asm("jbsr GC_push_one");
353           asm("movl %a5,%sp@"); asm("jbsr GC_push_one");
354           /* Skip frame pointer and stack pointer */
355           asm("movl %d1,%sp@"); asm("jbsr GC_push_one");
356           asm("movl %d2,%sp@"); asm("jbsr GC_push_one");
357           asm("movl %d3,%sp@"); asm("jbsr GC_push_one");
358           asm("movl %d4,%sp@"); asm("jbsr GC_push_one");
359           asm("movl %d5,%sp@"); asm("jbsr GC_push_one");
360           asm("movl %d6,%sp@"); asm("jbsr GC_push_one");
361           asm("movl %d7,%sp@"); asm("jbsr GC_push_one");
362   
363           asm("addqw #0x4,%sp");        /* put stack back where it was  */
364 #        else /* !__GNUC__*/
365           asm("subq.w &0x4,%sp");       /* allocate word on top of stack */
366   
367           asm("mov.l %a2,(%sp)"); asm("jsr GC_push_one");
368           asm("mov.l %a3,(%sp)"); asm("jsr GC_push_one");
369           asm("mov.l %a4,(%sp)"); asm("jsr GC_push_one");
370           asm("mov.l %a5,(%sp)"); asm("jsr GC_push_one");
371           /* Skip frame pointer and stack pointer */
372           asm("mov.l %d1,(%sp)"); asm("jsr GC_push_one");
373           asm("mov.l %d2,(%sp)"); asm("jsr GC_push_one");
374           asm("mov.l %d3,(%sp)"); asm("jsr GC_push_one");
375           asm("mov.l %d4,(%sp)"); asm("jsr GC_push_one");
376           asm("mov.l %d5,(%sp)"); asm("jsr GC_push_one");
377           asm("mov.l %d6,(%sp)"); asm("jsr GC_push_one");
378           asm("mov.l %d7,(%sp)"); asm("jsr GC_push_one");
379   
380           asm("addq.w &0x4,%sp");       /* put stack back where it was  */
381 #        endif /* !__GNUC__ */
382 #       endif /* M68K/SYSV */
383
384 #     if defined(PJ)
385         {
386             register int * sp asm ("optop");
387             extern int *__libc_stack_end;
388
389             GC_push_all_stack (sp, __libc_stack_end);
390         }
391 #     endif
392
393       /* other machines... */
394 #       if !(defined M68K) && !(defined VAX) && !(defined RT) 
395 #       if !(defined SPARC) && !(defined I386) && !(defined NS32K)
396 #       if !defined(POWERPC) && !defined(UTS4) 
397 #       if !defined(PJ) && !(defined(MIPS) && defined(LINUX))
398             --> bad news <--
399 #       endif
400 #       endif
401 #       endif
402 #       endif
403 }
404 #endif /* !USE_GENERIC_PUSH_REGS */
405
406 #if defined(USE_GENERIC_PUSH_REGS)
407 void GC_generic_push_regs(cold_gc_frame)
408 ptr_t cold_gc_frame;
409 {
410         /* Generic code                          */
411         /* The idea is due to Parag Patel at HP. */
412         /* We're not sure whether he would like  */
413         /* to be he acknowledged for it or not.  */
414         {
415             static jmp_buf regs;
416             register word * i = (word *) regs;
417             register ptr_t lim = (ptr_t)(regs) + (sizeof regs);
418
419             /* Setjmp on Sun 3s doesn't clear all of the buffer.  */
420             /* That tends to preserve garbage.  Clear it.         */
421                 for (; (char *)i < lim; i++) {
422                     *i = 0;
423                 }
424 #           if defined(POWERPC) || defined(MSWIN32) || defined(MSWINCE) \
425                || defined(UTS4) || defined(LINUX)
426                 (void) setjmp(regs);
427 #           else
428                 (void) _setjmp(regs);
429 #           endif
430 #           if defined(SPARC) || defined(IA64)
431               /* On a register window machine, we need to save register */
432               /* contents on the stack for this to work.  The setjmp    */
433               /* is probably not needed on SPARC, since pointers are    */
434               /* only stored in windowed or scratch registers.  It is   */
435               /* needed on IA64, since some non-windowed registers are  */
436               /* preserved.                                             */
437               {
438                 word GC_save_regs_in_stack();
439               
440                 GC_save_regs_ret_val = GC_save_regs_in_stack();
441               }
442 #           endif
443             GC_push_current_stack(cold_gc_frame);
444         }
445 }
446 #endif /* USE_GENERIC_PUSH_REGS */
447
448 /* On register window machines, we need a way to force registers into   */
449 /* the stack.   Return sp.                                              */
450 # ifdef SPARC
451     asm("       .seg    \"text\"");
452 #   ifdef SVR4
453       asm("     .globl  GC_save_regs_in_stack");
454       asm("GC_save_regs_in_stack:");
455       asm("     .type GC_save_regs_in_stack,#function");
456 #   else
457       asm("     .globl  _GC_save_regs_in_stack");
458       asm("_GC_save_regs_in_stack:");
459 #   endif
460 #   if defined(__arch64__) || defined(__sparcv9)
461       asm("     save    %sp,-128,%sp");
462       asm("     flushw");
463       asm("     ret");
464       asm("     restore %sp,2047+128,%o0");
465 #   else
466       asm("     ta      0x3   ! ST_FLUSH_WINDOWS");
467       asm("     retl");
468       asm("     mov     %sp,%o0");
469 #   endif
470 #   ifdef SVR4
471       asm("     .GC_save_regs_in_stack_end:");
472       asm("     .size GC_save_regs_in_stack,.GC_save_regs_in_stack_end-GC_save_regs_in_stack");
473 #   endif
474 #   ifdef LINT
475         word GC_save_regs_in_stack() { return(0 /* sp really */);}
476 #   endif
477 # endif
478
479 /* On IA64, we also need to flush register windows.  But they end       */
480 /* up on the other side of the stack segment.                           */
481 /* Returns the backing store pointer for the register stack.            */
482 # ifdef IA64
483 #   ifdef __GNUC__
484         asm("        .text");
485         asm("        .psr abi64");
486         asm("        .psr lsb");
487         asm("        .lsb");
488         asm("");
489         asm("        .text");
490         asm("        .align 16");
491         asm("        .global GC_save_regs_in_stack");
492         asm("        .proc GC_save_regs_in_stack");
493         asm("GC_save_regs_in_stack:");
494         asm("        .body");
495         asm("        flushrs");
496         asm("        ;;");
497         asm("        mov r8=ar.bsp");
498         asm("        br.ret.sptk.few rp");
499         asm("        .endp GC_save_regs_in_stack");
500 #   else
501         void GC_save_regs_in_stack() {
502           asm("        flushrs");
503           asm("        ;;");
504           asm("        mov r8=ar.bsp");
505           asm("        br.ret.sptk.few rp");
506         }
507 #   endif
508 # endif
509
510 /* GC_clear_stack_inner(arg, limit) clears stack area up to limit and   */
511 /* returns arg.  Stack clearing is crucial on SPARC, so we supply       */
512 /* an assembly version that's more careful.  Assumes limit is hotter    */
513 /* than sp, and limit is 8 byte aligned.                                */
514 #if defined(ASM_CLEAR_CODE) && !defined(THREADS)
515 #ifndef SPARC
516         --> fix it
517 #endif
518 # ifdef SUNOS4
519     asm(".globl _GC_clear_stack_inner");
520     asm("_GC_clear_stack_inner:");
521 # else
522     asm(".globl GC_clear_stack_inner");
523     asm("GC_clear_stack_inner:");
524     asm(".type GC_save_regs_in_stack,#function");
525 # endif
526 #if defined(__arch64__) || defined(__sparcv9)
527   asm("mov %sp,%o2");           /* Save sp                      */
528   asm("add %sp,2047-8,%o3");    /* p = sp+bias-8                */
529   asm("add %o1,-2047-192,%sp"); /* Move sp out of the way,      */
530                                 /* so that traps still work.    */
531                                 /* Includes some extra words    */
532                                 /* so we can be sloppy below.   */
533   asm("loop:");
534   asm("stx %g0,[%o3]");         /* *(long *)p = 0               */
535   asm("cmp %o3,%o1");
536   asm("bgu,pt %xcc, loop");     /* if (p > limit) goto loop     */
537     asm("add %o3,-8,%o3");      /* p -= 8 (delay slot) */
538   asm("retl");
539     asm("mov %o2,%sp");         /* Restore sp., delay slot      */
540 #else
541   asm("mov %sp,%o2");           /* Save sp      */
542   asm("add %sp,-8,%o3");        /* p = sp-8     */
543   asm("clr %g1");               /* [g0,g1] = 0  */
544   asm("add %o1,-0x60,%sp");     /* Move sp out of the way,      */
545                                 /* so that traps still work.    */
546                                 /* Includes some extra words    */
547                                 /* so we can be sloppy below.   */
548   asm("loop:");
549   asm("std %g0,[%o3]");         /* *(long long *)p = 0  */
550   asm("cmp %o3,%o1");
551   asm("bgu loop ");             /* if (p > limit) goto loop     */
552     asm("add %o3,-8,%o3");      /* p -= 8 (delay slot) */
553   asm("retl");
554     asm("mov %o2,%sp");         /* Restore sp., delay slot      */
555 #endif /* old SPARC */
556   /* First argument = %o0 = return value */
557 #   ifdef SVR4
558       asm("     .GC_clear_stack_inner_end:");
559       asm("     .size GC_clear_stack_inner,.GC_clear_stack_inner_end-GC_clear_stack_inner");
560 #   endif
561   
562 # ifdef LINT
563     /*ARGSUSED*/
564     ptr_t GC_clear_stack_inner(arg, limit)
565     ptr_t arg; word limit;
566     { return(arg); }
567 # endif
568 #endif