From 9160f2912eb57910e45b681b7b5eef9acb6a922e Mon Sep 17 00:00:00 2001 From: Steven Le Rouzic Date: Mon, 13 May 2024 12:21:59 +0200 Subject: OS Hello world --- os/boot.S | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 os/boot.S (limited to 'os/boot.S') 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!" -- cgit