source: rtems/c/src/lib/libbsp/hppa1.1/simhppa/start/start.s @ d637822

4.104.114.84.95
Last change on this file since d637822 was 254b4450, checked in by Joel Sherrill <joel.sherrill@…>, on 04/01/97 at 23:07:52

This set of changes is the build of what was required to convert to
GNU autoconf. This is the first large step in allowing an RTEMS
user to perform a one-tree build (per crossgcc FAQ) including RTEMS
in the build process. With this change RTEMS is configured in
built in the same style as the GNU tools, yet retains the basic
structure of its traditional Makefiles (ala Tony Bennett).
Jiri Gaisler (jgais@…) deserves (and received)
a big thank you for doing this.

There are still issues to be resolved but as of this commit, all target
which can be built on a linux host have been using a modified version
of the source Jiri submitted. This source was merged and most targets
built in the tree before this commit.

There are some issues which remain to be resolved but they are primarily
related to host OS dependencies, script issues, the use of gawk
for hack_specs, and the dependence on gcc snapshots. These will
be resolved.

  • 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 main, 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 "main" routine from the application to get it going.
79 * We call it as main(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      main,%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.