Pristine Ack-5.5
[Ack-5.5.git] / mach / sparc / libsys / head_em.s
1 .global lino,filn
2 .global EXIT
3 .global begtext,begdata,begbss
4 .global EARRAY,ERANGE,ESET,EIDIVZ,EHEAP,EILLINS,ECASE,EBADGTO
5 .global hol0,reghp,limhp,trpim,trppc
6
7 ! runtime startof for sparc on sun4
8
9
10 LINO_AD = 0
11 FILN_AD = 4
12
13 EARRAY  = 0
14 ERANGE  = 1
15 ESET    = 2
16 EIDIVZ  = 6
17 EHEAP   = 17
18 EILLINS = 18
19 ECASE   = 20
20 EBADGTO = 27
21
22         .seg "text"
23
24 begtext:
25         clr     %fp
26         ld      [%sp + 0x40], %o0
27         add     %sp, 0x44, %o1
28         sll     %o0, 0x2, %o2
29         add     %o2, 0x4, %o2
30         add     %o1, %o2, %o2
31         set     -0x100000, %g4          ! should be a few M
32         clr     %l1
33         mov     %sp, %l0
34         add     %sp, %g4, %sp
35         dec     12, %l0
36                                         ! enable divide by 0 trap and improper
37                                         ! trap
38         st      %fsr, [%l0]
39         ld      [%l0], %o3
40         set     0x09000000, %o4
41         or      %o3, %o4, %o3
42         st      %o3, [%l0]
43         ld      [%l0], %fsr
44
45         st      %o0, [%l0]
46         st      %o1, [%l0+4]
47         st      %o2, [%l0+8]
48
49         call    __m_a_i_n
50         nop
51         dec     4, %l0
52         st      %g0, [%l0]
53 EXIT:
54         call    __exit
55         nop
56
57         .seg "data"
58 begdata:
59         .word 0         ! may be at virtual address 0 with no problem
60 hol0:
61 lino:
62         .word   0       ! lino
63 filn:
64         .word   0       ! filn
65 reghp:
66         .word   __end
67 limhp:
68         .word   __end
69 trppc:
70         .word   0
71 trpim:
72         .word   0       ! USED TO BE 2 BYTES; IS THIS RIGHT?
73
74
75         .seg "bss"
76 begbss: !initialization is not needed because ALL entries are in zero space!