summaryrefslogtreecommitdiff
path: root/os/boot.S
diff options
context:
space:
mode:
authorSteven Le Rouzic <steven.lerouzic@gmail.com>2024-05-13 12:21:59 +0200
committerSteven Le Rouzic <steven.lerouzic@gmail.com>2024-05-13 12:21:59 +0200
commit9160f2912eb57910e45b681b7b5eef9acb6a922e (patch)
tree2ec20d782cd5a05a2bebe2f6756456f1d4caa4d9 /os/boot.S
parentf95a85de0082010e4af83e26e99299d601bb48d6 (diff)
OS Hello worldHEADmain
Diffstat (limited to 'os/boot.S')
-rw-r--r--os/boot.S31
1 files changed, 31 insertions, 0 deletions
diff --git a/os/boot.S b/os/boot.S
new file mode 100644
index 0000000..afb966c
--- /dev/null
+++ b/os/boot.S
@@ -0,0 +1,31 @@
+.option norvc
+
+.section .init
+
+.equ UART_BASE, 0x10000000
+
+.global kstart
+kstart:
+ la a0, _str
+ call _println
+
+_halt:
+ wfi
+ j _halt
+
+_println:
+ li t0, UART_BASE
+_println_loop:
+ lb t1, 0(a0)
+ beqz t1, _end_println_loop
+ sb t1, 0(t0)
+ addi a0, a0, 1
+ j _println_loop
+_end_println_loop:
+ li t1, '\n'
+ sb t1, 0(t0)
+ ret
+
+.section .rodata
+
+_str: .string "Hello, world!"