summaryrefslogtreecommitdiff
path: root/boards
diff options
context:
space:
mode:
Diffstat (limited to 'boards')
-rw-r--r--boards/qemu-virt/qemu-virt.s32
1 files changed, 30 insertions, 2 deletions
diff --git a/boards/qemu-virt/qemu-virt.s b/boards/qemu-virt/qemu-virt.s
index 4628564..a2618d2 100644
--- a/boards/qemu-virt/qemu-virt.s
+++ b/boards/qemu-virt/qemu-virt.s
@@ -1,26 +1,54 @@
.section .text.start
.extern main
+.extern CONSOLE_STRICT_FLUSH
.global _start
+.type _start, STT_FUNC
_start:
# Have harts other than 0 spin until hart0 wakes them up.
csrr a0, mhartid
c.bnez a0, wait_for_hart0
+ # Set up console_strict_flush.
+ la t0, console_strict_flush
+ la t1, CONSOLE_STRICT_FLUSH
+ sd t0, (t1)
+
# Set up hart0's stack.
la sp, hart0_initial_stack_top
# Call hart0_boot with the address of the DeviceTree.
- c.mv a1, a0
+ c.mv a0, a1
call hart0_boot
-
# Fall through to a spin loop.
+.size _start, . - _start
+
+.type halt, STT_FUNC
halt:
j halt
+.size halt, . - halt
+
+.section .text
+
+.type console_strict_flush, STT_FUNC
+console_strict_flush:
+ li t0, 0x10000000
+1:
+ c.beqz a1, 2f
+ lb t1, (a0)
+ sb t1, (t0)
+ addi a0, a0, 1
+ addi a1, a1, -1
+ j 1b
+2:
+ ret
+.size console_strict_flush, . - console_strict_flush
.section .text
+.type wait_for_hart0, STT_FUNC
wait_for_hart0:
# TODO
j halt
+.size wait_for_hart0, . - wait_for_hart0