File tree Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -43,13 +43,35 @@ unsafe extern "C" fn entry() -> ! {
43
43
".word 0" ,
44
44
".word 0" ,
45
45
".word 0" ,
46
- "1: la sp, {stack}
46
+ "1:" ,
47
+ // configure mxstatus register
48
+ // PM = 0b11 (Current privilege mode is Machine mode)
49
+ // THEADISAEE = 1 (Enable T-Head ISA)
50
+ // MAEE = 1 (Enable extended MMU attributes)
51
+ // MHRD = 0 (Disable TLB hardware refill)
52
+ // CLINTEE = 1 (CLINT usoft and utimer can be responded)
53
+ // UCME = 1 (Enable extended cache instructions on U-mode)
54
+ // MM = 1 (Enable hardware unaligned memory access)
55
+ // PMP4K = 0 (read-only, PMP granularity 4KiB)
56
+ // PMDM = 0 (allow performance counter on M-mode)
57
+ // PMDS = 0 (allow performance counter on S-mode)
58
+ // PMDU = 0 (allow performance counter on U-mode)
59
+ " li t0, 0xc0638000
60
+ csrw 0x7c0, t0" ,
61
+ // invalid I-cache, D-cache, BHT and BTB by writing mcor register
62
+ " li t2, 0x30013
63
+ csrw 0x7c2, t2" ,
64
+ // enable I-cache, D-cache by mhcr register
65
+ " csrsi 0x7c1, 0x3" ,
66
+ // load stack address
67
+ " la sp, {stack}
47
68
li t0, {hart_stack_size}
48
69
add sp, sp, t0" ,
70
+ // clear bss segment
49
71
" la t1, sbss
50
72
la t2, ebss
51
73
1: bgeu t1, t2, 1f
52
- sd zero, 0(t1)
74
+ sd zero, 0(t1)
53
75
addi t1, t1, 8
54
76
j 1b
55
77
1:" ,
You can’t perform that action at this time.
0 commit comments