summaryrefslogtreecommitdiff
path: root/boards/qemu-virt/qemu-virt.s
diff options
context:
space:
mode:
Diffstat (limited to 'boards/qemu-virt/qemu-virt.s')
-rw-r--r--boards/qemu-virt/qemu-virt.s36
1 files changed, 31 insertions, 5 deletions
diff --git a/boards/qemu-virt/qemu-virt.s b/boards/qemu-virt/qemu-virt.s
index f0599da..36ccee0 100644
--- a/boards/qemu-virt/qemu-virt.s
+++ b/boards/qemu-virt/qemu-virt.s
@@ -71,17 +71,36 @@ _start:
.type hart0_full_boot, STT_FUNC
hart0_full_boot:
- ## Set up hart0's stack.
- la sp, hart0_initial_stack_top
+ ## Set up hart0's stack, leaving room for the EarlyBootAddrs.
+ la sp, hart0_initial_stack_top - 9 * 8
- ## Write a canary to hart0's stack.
+ ## Write a canary to the bottom of hart0's stack.
li t0, 0xdead0bad0defaced
la t1, hart0_initial_stack
sd t0, (t1)
+ ## Store the DeviceTree and the appropriate addresses into the
+ ## EarlyBootAddrs.
+ sd a1, (0 * 8)(sp)
+ la t0, kernel_start
+ sd t0, (1 * 8)(sp)
+ la t0, kernel_end
+ sd t0, (2 * 8)(sp)
+ la t0, kernel_rx_end
+ sd t0, (3 * 8)(sp)
+ la t0, kernel_ro_end
+ sd t0, (4 * 8)(sp)
+ la t0, kernel_rw_end
+ sd t0, (5 * 8)(sp)
+ sd t1, (6 * 8)(sp) # This is still hart0_initial_stack from above.
+ la t0, hart0_initial_stack_top
+ sd t0, (7 * 8)(sp)
+ la t0, trampoline_start
+ sd t0, (8 * 8)(sp)
+
## Call hart0_early_boot, passing it the DeviceTree we received and
## getting back the address of a stack to switch to.
- mv a0, a1
+ mv a0, sp
call hart0_early_boot
## Switch to the returned stack.
@@ -99,7 +118,14 @@ hart0_full_boot:
.type wait_for_hart0, STT_FUNC
wait_for_hart0:
- # TODO
+ ## TODO
wfi
j wait_for_hart0
.size wait_for_hart0, . - wait_for_hart0
+
+.section .trampoline_page
+
+trap_handler:
+ ## TODO
+ wfi
+ j trap_handler