implemented Setup.hs to build boehm cpp libs and install them;
[hs-boehmgc.git] / gc-7.2 / sparc_mach_dep.S
1 !       SPARCompiler 3.0 and later apparently no longer handles
2 !       asm outside functions.  So we need a separate .s file
3 !       This is only set up for SunOS 5, not SunOS 4.
4 !       Assumes this is called before the stack contents are
5 !       examined.
6
7         .seg    "text"
8         .globl  GC_save_regs_in_stack
9 GC_save_regs_in_stack:
10 #if defined(__arch64__) || defined(__sparcv9)
11         save    %sp,-128,%sp
12         flushw
13         ret
14           restore %sp,2047+128,%o0
15 #else /* 32 bit SPARC */
16         ta      0x3   ! ST_FLUSH_WINDOWS
17         mov     %sp,%o0
18         retl
19         nop
20 #endif /* 32 bit SPARC */
21 .GC_save_regs_in_stack_end:
22         .size GC_save_regs_in_stack,.GC_save_regs_in_stack_end-GC_save_regs_in_stack
23
24 ! GC_clear_stack_inner(arg, limit) clears stack area up to limit and
25 ! returns arg.  Stack clearing is crucial on SPARC, so we supply
26 ! an assembly version that s more careful.  Assumes limit is hotter
27 ! than sp, and limit is 8 byte aligned.
28         .globl  GC_clear_stack_inner
29 GC_clear_stack_inner:
30 #if defined(__arch64__) || defined(__sparcv9)
31         mov %sp,%o2             ! Save sp
32         add %sp,2047-8,%o3      ! p = sp+bias-8
33         add %o1,-2047-192,%sp   ! Move sp out of the way,
34                                 ! so that traps still work.
35                                 ! Includes some extra words
36                                 ! so we can be sloppy below.
37 loop:
38         stx %g0,[%o3]           ! *(long *)p = 0
39         cmp %o3,%o1
40         bgu,pt %xcc, loop       ! if (p > limit) goto loop
41           add %o3,-8,%o3        ! p -= 8 (delay slot)
42         retl
43           mov %o2,%sp           ! Restore sp., delay slot
44 #else  /* 32 bit SPARC */
45         mov     %sp,%o2         ! Save sp
46         add     %sp,-8,%o3      ! p = sp-8
47         clr     %g1             ! [g0,g1] = 0
48         add     %o1,-0x60,%sp   ! Move sp out of the way,
49                                 ! so that traps still work.
50                                 ! Includes some extra words
51                                 ! so we can be sloppy below.
52 loop:
53         std     %g0,[%o3]       ! *(long long *)p = 0
54         cmp     %o3,%o1
55         bgu     loop            ! if (p > limit) goto loop
56           add   %o3,-8,%o3      ! p -= 8 (delay slot)
57         retl
58           mov   %o2,%sp         ! Restore sp., delay slot
59 #endif  /* 32 bit SPARC */
60 .GC_clear_stack_inner_end:
61         .size GC_clear_stack_inner,.GC_clear_stack_inner_end-GC_clear_stack_inner