source: rtems/c/src/lib/libbsp/hppa1.1/simhppa/start/start.S @ 887458a1

4.104.114.84.95
Last change on this file since 887458a1 was 0162910, checked in by Joel Sherrill <joel.sherrill@…>, on 12/14/98 at 23:15:38

Patch from Ralf Corsepius <corsepiu@…> to rename all
.s files to .S in conformance with GNU conventions. This is a
minor step along the way to supporting automake.

  • Property mode set to 100644
File size: 3.6 KB
Line 
1/*
2 * crt0.S -- startup file for hppa on RTEMS
3 *
4 *  $Id$
5 */
6
7        .COPYRIGHT "crt0.S for hppa"
8
9        .DATA
10
11_progname       .STRINGZ "simhppa"
12_crt0_argv      .WORD    _progname, 0
13
14/*
15 * Set up the standard spaces (sections) These definitions come
16 * from /lib/pcc_prefix.s.
17 */
18        .TEXT
19       
20/*
21 * stuff we need that is defined elsewhere.
22 */
23        .IMPORT boot_card, CODE
24        .IMPORT _bss_start, DATA
25        .IMPORT _bss_end, DATA
26        .IMPORT environ, DATA
27
28/*
29 * start -- set things up so the application will run.
30 *
31 */
32        .PROC
33        .CALLINFO SAVE_SP, FRAME=48
34        .EXPORT $START$,ENTRY
35        .EXPORT start,ENTRY
36$START$
37start:
38
39/*
40 * Get a stack
41 */
42       
43        ldil    L%crt_stack+48,%r30
44        ldo     R%crt_stack+48(%r30),%r30
45
46/*
47 * we need to set %r27 (global data pointer) here
48 */
49
50        ldil    L%$global$,%r27
51        ldo     R%$global$(%r27),%r27
52
53/*
54 * zerobss -- zero out the bss section
55 * XXX We don't do this since simulator and boot rom will do this for us.
56 */
57#if 0
58        ; load the start of bss
59        ldil    L%_bss_start,%r4
60        ldo     R%_bss_start(%r4),%r4
61
62        ;  load the end of bss
63        ldil    L%_bss_end,%r5
64        ldo     R%_bss_end(%r5),%r5
65
66
67bssloop
68        addi    -1,%r5,%r5                      ; decrement _bss_end
69        stb     %r0,0(0,%r5)                    ; we do this by bytes for now even
70                                                ; though it is slower, it is safer
71        combf,= %r4,%r5, bssloop       
72        nop
73#endif
74   
75        ldi     1,%ret0
76
77/*
78 * Call the "boot_card" routine from the application to get it going.
79 * We call it as boot_card(1, argv, 0)
80 */
81
82        copy    %r0, %r24
83
84        ldil    L%_crt0_argv,%r25
85        ldo     R%_crt0_argv(%r25),%r25
86
87        bl      boot_card,%r2
88        ldo     1(%r0), %r26
89
90        .PROCEND
91/*
92 * _exit -- Exit from the application. Normally we cause a user trap
93 *          to return to the ROM monitor for another run, but with
94 *          this monitor we can not. Still, "C" wants this symbol, it
95 *          should be here. Jumping to 0xF0000004 jumps back into the
96 *          firmware, while writing a 5 to 0xFFFE0030 causes a reset.
97 */
98_exit_fallthru
99        .PROC
100        .CALLINFO
101        .ENTRY
102       
103        ;; This just causes a breakpoint exception
104        break   0x0,0x0
105        bv,n    (%rp)
106        nop
107        .EXIT
108        .PROCEND
109
110/*
111 * _sr4export -- support for called functions. (mostly for GDB)
112 */
113        .EXPORT _sr4export, ENTRY
114_sr4export:
115        .PROC
116        .CALLINFO
117        .ENTRY
118
119        ble     0(%sr4,%r22)
120        copy    %r31,%rp
121        ldw     -18(%sr0,%sp),%rp
122        ldsid   (%sr0,%rp),%r1
123        mtsp    %r1,%sr0
124        be,n    0(%sr0,%rp)
125        nop
126        .EXIT
127        .PROCEND
128
129
130        .subspa $UNWIND_START$,QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=56
131        .export $UNWIND_START
132$UNWIND_START
133        .subspa $UNWIND$,QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=64
134        .subspa $UNWIND_END$,QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=72
135        .export $UNWIND_END
136$UNWIND_END
137        .subspa $RECOVER_START$,QUAD=0,ALIGN=4,ACCESS=0x2c,SORT=73
138        .export $RECOVER_START
139$RECOVER_START
140        .subspa $RECOVER$,QUAD=0,ALIGN=4,ACCESS=0x2c,SORT=80
141        .subspa $RECOVER_END$,QUAD=0,ALIGN=4,ACCESS=0x2c,SORT=88
142        .export $RECOVER_END
143$RECOVER_END
144
145/*
146 * Here we set up the standard date sub spaces.
147 *
148 * Set up some room for a stack. We just grab a chunk of memory.
149 * We also setup some space for the global variable space, which
150 * must be done using the reserved name "$global$" so "C" code
151 * can find it. The stack grows towards the higher addresses.
152 */
153
154        .subspa $DATA$,QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=16
155        .subspa $SHORTDATA$,QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=24
156        .subspa $GLOBAL$,QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=40
157        .export $global$
158$global$
159        .subspa $SHORTBSS$,QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=80,ZERO
160        .subspa $BSS$,QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=82,ZERO
161
162        .subspa $STACK$,QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=88,ZERO
163
164        .export crt_stack
165crt_stack
166        .comm          0x1000
167
168        .end
169
Note: See TracBrowser for help on using the repository browser.