![]() |
|
|||
File indexing completed on 2025-05-11 08:23:50
0001 /* 0002 * start.S -- startup file for Cogent CSB350 Au1100 based board 0003 * 0004 * Copyright (c) 2005 by Cogent Computer Systems 0005 * Written by Jay Monkman <jtm@lopingdog.com> 0006 * 0007 * The license and distribution terms for this file may be 0008 * found in the file LICENSE in this distribution or at 0009 * http://www.rtems.org/license/LICENSE. 0010 * 0011 */ 0012 0013 #include <rtems/asm.h> 0014 #include <bsp/regs.h> 0015 0016 .text 0017 .align 2 0018 0019 /* Without the following nop, GDB thinks _start is a data variable. 0020 * This is probably a bug in GDB in handling a symbol that is at the 0021 * start of the .text section. 0022 */ 0023 nop 0024 0025 .globl _start 0026 .ent _start 0027 _start: 0028 .set noreorder 0029 0030 /* Get the address of start into $5 in a position independent 0031 * fashion. This lets us know whether we have been relocated or not. 0032 */ 0033 $LF1 = . + 8 0034 bal $LF1 0035 nop 0036 _branch: 0037 move $5, $31 /* $5 == where are we */ 0038 li $6, 0x8800000c /* $6 == where we want to be */ 0039 0040 li v0, SR_CU1|SR_PE|SR_FR|SR_KX|SR_SX|SR_UX 0041 mtc0 v0, C0_SR 0042 mtc0 zero, C0_CAUSE 0043 0044 1: 0045 li v0, SR_PE|SR_FR|SR_KX|SR_SX|SR_UX 0046 mtc0 v0, C0_SR 0047 2: 0048 /* Fix high bits, if any, of the PC so that exception handling 0049 doesn't get confused. */ 0050 la v0, 3f 0051 jr v0 0052 nop 0053 3: 0054 la gp, _gp /* set the global data pointer */ 0055 .end _start 0056 0057 /* 0058 * zero out the bss section. 0059 */ 0060 .globl zerobss 0061 .ent zerobss 0062 zerobss: 0063 la v0, _fbss 0064 la v1, _end 0065 3: 0066 sw zero,0(v0) 0067 bltu v0,v1,3b 0068 addiu v0,v0,4 /* executed in delay slot */ 0069 0070 la t0, _ISR_Stack_area_end /* initialize stack so we */ 0071 /* We must subtract 24 bytes for the 3 8 byte arguments to main, in 0072 case main wants to write them back to the stack. The caller is 0073 supposed to allocate stack space for parameters in registers in 0074 the old MIPS ABIs. We must do this even though we aren't passing 0075 arguments, because main might be declared to have them. 0076 0077 Some ports need a larger alignment for the stack, so we subtract 0078 32, which satisifes the stack for the arguments and keeps the 0079 stack pointer better aligned. */ 0080 subu t0,t0,32 0081 move sp,t0 /* set stack pointer */ 0082 .end zerobss 0083 0084 .globl exit .text 0085 .globl init 0086 .ent init 0087 init: 0088 0089 move a0,zero /* set command line to 0 */ 0090 jal boot_card /* call the program start function */ 0091 nop 0092 0093 /* fall through to the "exit" routine */ 0094 jal _sys_exit /* call libc exit to run the G++ */ 0095 /* destructors */ 0096 move a0,v0 /* pass through the exit code */ 0097 .end init 0098 0099 /* 0100 * _sys_exit -- Exit from the application. Normally we cause a user trap 0101 * to return to the ROM monitor for another run. NOTE: This is 0102 * the only other routine we provide in the crt0.o object, since 0103 * it may be tied to the "_start" routine. It also allows 0104 * executables that contain a complete world to be linked with 0105 * just the crt0.o object. 0106 */ 0107 .globl _sys_exit 0108 .ent _sys_exit 0109 _sys_exit: 0110 7: 0111 #ifdef GCRT0 0112 jal _mcleanup 0113 nop 0114 #endif 0115 /* break inst. can cope with 0xfffff, but GAS limits the range: */ 0116 break 1023 0117 nop 0118 b 7b /* but loop back just in-case */ 0119 nop 0120 .end _sys_exit 0121 0122 /* EOF crt0.S */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |