File indexing completed on 2025-05-11 08:23:50
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #include <rtems/asm.h>
0021 #include <bsp/regs.h>
0022
0023 #include <bsp.h>
0024
0025 #ifdef __mips16
0026
0027 .set nomips16
0028 #endif
0029
0030
0031
0032 #ifdef __mips_embedded_pic
0033 # ifdef __mips64
0034 # define LA(t,x) la t,x-PICBASE ; daddu t,s0,t
0035 # else
0036 # define LA(t,x) la t,x-PICBASE ; addu t,s0,t
0037 # endif
0038 #else
0039 # define LA(t,x) la t,x
0040 #endif
0041
0042 .text
0043 .align 2
0044
0045
0046
0047
0048
0049 nop
0050 nop
0051 nop
0052 nop
0053 nop
0054 nop
0055 nop
0056 nop
0057 nop
0058 .globl _start
0059 .ent _start
0060 _start:
0061 nop
0062 nop
0063 nop
0064 nop
0065 nop
0066 nop
0067 nop
0068 nop
0069 .set noreorder
0070
0071
0072
0073 $LF1 = . + 8
0074 bal $LF1
0075 nop
0076 _branch:
0077 #if 0
0078 move $5, $31 # $5 == where are we
0079 li $6, 0x8800000c # $6 == where we want to be
0080
0081 beq $5, $6, _start_in_ram
0082 nop
0083
0084 la $7, _edata
0085 relocate:
0086 nop
0087 lw $8, ($5) # $8 = *EEPROM
0088 addu $5, $5, 4 # EEPROM++
0089 sw $8, ($6) # *RAM = $8
0090 addu $6, $6, 4 # RAM++
0091 bne $6, $7, relocate # copied all the way to edata?
0092 nop
0093 la $6, _start_in_ram
0094 jr $6
0095 nop
0096 .end _start
0097
0098 .globl _start_in_ram
0099 .ent _start_in_ram
0100 #endif
0101 _start_in_ram:
0102 nop
0103 #if 0
0104 #ifdef __mips_embedded_pic
0105 PICBASE = .+8
0106 bal PICBASE
0107 nop
0108 move s0,$31
0109 #endif
0110 #endif
0111 li v0, SR_CU1|SR_PE|SR_FR|SR_KX|SR_SX|SR_UX
0112 mtc0 v0, C0_SR
0113 mtc0 zero, C0_CAUSE
0114
0115 #if 0
0116
0117 #ifndef __mips_soft_float
0118
0119
0120 li t2,0xAAAA5555
0121 mtc1 t2,fp0
0122 mtc1 zero,fp1
0123 mfc1 t0,fp0
0124 mfc1 t1,fp1
0125 nop
0126 bne t0,t2,1f
0127 nop
0128 bne t1,zero,1f
0129 nop
0130 #ifndef __mips64
0131 li v0, SR_CU1|SR_PE|SR_KX|SR_SX|SR_UX
0132 mtc0 v0, C0_SR
0133 #endif
0134 j 2f
0135 nop
0136 #endif
0137 #endif
0138
0139 1:
0140 li v0, SR_PE|SR_FR|SR_KX|SR_SX|SR_UX
0141 mtc0 v0, C0_SR
0142 2:
0143
0144
0145 LA (v0, 3f)
0146 jr v0
0147 nop
0148 3:
0149 LA (gp, _gp) # set the global data pointer
0150 #if 0
0151 .end _start_in_ram
0152 #else
0153 .end _start
0154 #endif
0155
0156
0157
0158
0159 .globl zerobss
0160 .ent zerobss
0161 zerobss:
0162 LA (v0, _fbss)
0163 LA (v1, _end)
0164 3:
0165 sw zero,0(v0)
0166 bltu v0,v1,3b
0167 addiu v0,v0,4 # executed in delay slot
0168
0169 la t0, _ISR_Stack_area_end # initialize stack so we
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179 subu t0,t0,32
0180 move sp,t0 # set stack pointer
0181 .end zerobss
0182
0183 .globl exit .text
0184 .globl init
0185 .ent init
0186 init:
0187 nop
0188 jal init_tlb
0189 move a0,zero # set command line to 0
0190 jal boot_card # call the program start function
0191 nop
0192
0193 dead:
0194 b dead
0195 nop
0196 .end init
0197
0198
0199
0200
0201
0202
0203
0204
0205
0206 .globl _sys_exit
0207 .ent _sys_exit
0208 _sys_exit:
0209 7:
0210 #ifdef GCRT0
0211 jal _mcleanup
0212 nop
0213 #endif
0214
0215 break 1023
0216 nop
0217 b 7b # but loop back just in-case
0218 nop
0219 .end _sys_exit
0220
0221