source: rtems/c/src/lib/libbsp/mips/csb350/start/start.S @ cba119c9

4.104.114.84.95
Last change on this file since cba119c9 was 7cde240, checked in by Jay Monkman <jtm@…>, on 02/25/05 at 05:18:07

2005-02-24 Jay Monkman <jtm@…>

  • acinclude.m4: Added csb350 to list of BSPs.
  • csb350/Makefile.am, csb350/README, csb350/bsp_specs, csb350/configure.ac, csb350/times, csb350/clock/clockdrv.c, csb350/console/console-io.c, csb350/include/bsp.h, csb350/include/tm27.h, csb350/network/network.c, csb350/start/regs.S, csb350/start/start.S, csb350/startup/bspclean.c, csb350/startup/bspstart.c, csb350/startup/linkcmds, csb350/timer/timer.c: New BSP.
  • Property mode set to 100644
File size: 3.0 KB
Line 
1/*
2 * start.S -- startup file for Cogent CSB350 Au1100 based board
3 *
4 *  Copyright (c) 2005 by Cogent Computer Systems
5 *  Written by Jay Monkman <jtm@lopingdog.com>
6 *     
7 *  The license and distribution terms for this file may be
8 *  found in found in the file LICENSE in this distribution or at
9 *  http://www.OARcorp.com/rtems/license.html.
10 *
11 *  $Id$
12 *
13 */
14
15#include <rtems/asm.h>
16#include "regs.S"
17
18        .text
19        .align  2
20
21/* Without the following nop, GDB thinks _start is a data variable.
22 * This is probably a bug in GDB in handling a symbol that is at the
23 * start of the .text section.
24 */
25        nop
26
27        .globl  _start
28        .ent    _start
29_start:
30        .set    noreorder
31
32        /* Get the address of start into $5 in a position independent
33         * fashion. This lets us know whether we have been relocated or not.
34         */
35        $LF1 = . + 8
36        bal     $LF1
37        nop
38_branch:
39        move    $5, $31                 /* $5 == where are we */
40        li      $6, 0x8800000c          /* $6 == where we want to be */
41
42        li      v0, SR_CU1|SR_PE|SR_FR|SR_KX|SR_SX|SR_UX
43        mtc0    v0, C0_SR
44        mtc0    zero, C0_CAUSE
45
461:
47        li      v0, SR_PE|SR_FR|SR_KX|SR_SX|SR_UX
48        mtc0    v0, C0_SR
492:
50/* Fix high bits, if any, of the PC so that exception handling
51   doesn't get confused.  */
52        la v0, 3f
53        jr      v0
54        nop
553:
56        la gp, _gp                      /* set the global data pointer */
57        .end _start
58
59/*
60 * zero out the bss section.
61 */
62        .globl  __memsize
63        .globl  zerobss
64        .ent    zerobss
65zerobss:
66        la v0, _fbss
67        la v1, _end
683:
69        sw      zero,0(v0)
70        bltu    v0,v1,3b
71        addiu   v0,v0,4                 /* executed in delay slot */
72
73        la      t0, _stack_init         /* initialize stack so we */
74        /* We must subtract 24 bytes for the 3 8 byte arguments to main, in
75           case main wants to write them back to the stack.  The caller is
76           supposed to allocate stack space for parameters in registers in
77           the old MIPS ABIs.  We must do this even though we aren't passing
78           arguments, because main might be declared to have them.
79
80           Some ports need a larger alignment for the stack, so we subtract
81           32, which satisifes the stack for the arguments and keeps the
82           stack pointer better aligned.  */
83        subu    t0,t0,32
84        move    sp,t0                   /* set stack pointer */
85        .end    zerobss
86
87        .globl  exit .text
88        .globl  init
89        .ent    init
90init:
91
92        move    a0,zero                 /* set argc to 0 */
93        jal     boot_card               /* call the program start function */
94        nop
95
96        /* fall through to the "exit" routine */
97        jal     _sys_exit               /* call libc exit to run the G++ */
98                                        /* destructors */
99        move    a0,v0                   /* pass through the exit code */
100        .end    init
101       
102/*
103 * _sys_exit -- Exit from the application. Normally we cause a user trap
104 *          to return to the ROM monitor for another run. NOTE: This is
105 *          the only other routine we provide in the crt0.o object, since
106 *          it may be tied to the "_start" routine. It also allows
107 *          executables that contain a complete world to be linked with
108 *          just the crt0.o object.
109 */
110        .globl  _sys_exit
111        .ent _sys_exit
112_sys_exit:
1137:
114#ifdef GCRT0
115        jal     _mcleanup
116        nop
117#endif
118        /* break inst. can cope with 0xfffff, but GAS limits the range: */
119        break   1023
120        nop
121        b       7b                      /* but loop back just in-case */
122        nop
123        .end _sys_exit
124       
125/* EOF crt0.S */
Note: See TracBrowser for help on using the repository browser.