entry.s
1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <regdef.h>
#include <asm.h>
#include <PR/R4300.h>
#include <PR/bcp.h>
#include "boot.h"
// XXX: t7 is reserved for use in TRACE macros, do not use.
.text
.align 2
.set noreorder
.globl __entry
__entry:
# this must be done before any lw or sw
mtc0 zero, C0_WATCHLO
mtc0 zero, C0_WATCHHI
# poll virage2 ctrl for ready bit
la t0, PHYS_TO_K1(VIRAGE2_CTRL_REG)
virage2_poll:
lw t1, 0(t0)
and t2, t1, VIRAGE_CTRL_NV_RCREADY
beqz t2, virage2_poll
nop
patch1_return:
# take IDE out of reset so future TRACEs will work
li t0, PHYS_TO_K1(PI_IDE_CONFIG_REG)
lw t1, 0(t0)
and t1, ~PI_IDE_CONFIG_RESET
sw t1, 0(t0)
TRACE_VAL(0x1)
# copy ROM code to IRAM
# t0: dst
# t2: src
# t1: end
la t0, PHYS_TO_K1(INTERNAL_RAM_START)
la t2, __s_la_text
la t1, __e_text
copy_rom_to_iram:
lw t3, 0(t2) # the rom instruction
sw t3, 0(t0) # save to iram
addu t0, 4
bltu t0, t1, copy_rom_to_iram
addu t2, 4
la t0, __start
jr t0
nop