-
-
Save heatd/59fc0131bdbcd2e299f296add28557ef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lla t0, boot_page_tables | |
mv t1, t0 | |
li t3, 4096 | |
add t0, t0, t3 | |
mv t2, t0 | |
add t0, t0, t3 | |
mv t6, t0 | |
ori t0, t2, 1 | |
addi a1, t1, 2044 | |
sd t0, 2044(a1) | |
ori t0, t6, 1 | |
sd t0, 0(t1) | |
# Map the first 2GB of DRAM on 0xffffffff80000000 such that we end up executing on -2GB | |
li t4, 0x80000000 | |
ori t4, t4, 0xf # 0xf = valid, readable, writeable and executable | |
addi a1, t2, 2044 | |
sd t4, 2036(a1) | |
sd t4, 16(t6) | |
li t4, 0x90000000 | |
ori t4, t4, 0xf | |
addi a1, t2, 2044 | |
sd t4, 2044(a1) | |
sd t4, 24(t6) | |
srli t1, t1, 12 | |
li t5, 9 << 60 | |
or t1, t1, t5 | |
csrw satp, t1 | |
li t0, (1 << 11) | |
csrw mstatus, t0 | |
la t1, 1f | |
csrw mepc, t1 | |
mret | |
1: | |
j . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment