OS Hello world

This commit is contained in:
2024-05-13 12:21:59 +02:00
parent f95a85de00
commit 9160f2912e
6 changed files with 99 additions and 0 deletions

31
os/boot.S Normal file
View File

@ -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!"