2021-08-13 20:40:53 +08:00
|
|
|
#include <asm/asm.h>
|
|
|
|
#include <asm/regdef.h>
|
|
|
|
#include <cpu_cde.h>
|
|
|
|
|
2021-08-14 20:18:43 +08:00
|
|
|
.set noreorder
|
|
|
|
.section .text.init
|
|
|
|
.globl _init
|
|
|
|
_init:
|
|
|
|
lui t2, 0x0040
|
|
|
|
mtc0 t2, c0_status # turn off timer interrupt
|
|
|
|
mtc0 zero, c0_cause # clear cause
|
|
|
|
la sp, _stack # setup stack
|
|
|
|
la gp, _gp # setup small data
|
2021-08-13 20:40:53 +08:00
|
|
|
|
2021-08-14 20:18:43 +08:00
|
|
|
# Copy text to a000_0000 -> 8000_0000
|
|
|
|
la t0, _text_code_begin
|
|
|
|
la t1, _text_code_end
|
|
|
|
li t2, 0xa0000000
|
|
|
|
or t0, t0, t2
|
|
|
|
or t1, t1, t2
|
|
|
|
li t2, 0xbfc00000
|
|
|
|
or t2, t2, t0
|
|
|
|
copy:
|
|
|
|
lw t3, 0(t2)
|
|
|
|
addiu t2, t2, 4
|
|
|
|
sw t3, 0(t0)
|
|
|
|
addiu t0, t0, 4
|
|
|
|
bne t0, t1, copy
|
|
|
|
nop
|
2021-08-13 20:40:53 +08:00
|
|
|
|
2021-08-14 20:18:43 +08:00
|
|
|
lui k0, %hi(main)
|
|
|
|
addiu k0, %lo(main)
|
|
|
|
jr k0
|
|
|
|
nop
|
2021-08-13 20:40:53 +08:00
|
|
|
|
2021-08-14 20:18:43 +08:00
|
|
|
.section .text.exception
|
|
|
|
_EXCEPTION:
|
|
|
|
b _EXCEPTION
|
|
|
|
nop
|