OS Hello world
This commit is contained in:
31
os/boot.S
Normal file
31
os/boot.S
Normal 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!"
|
Reference in New Issue
Block a user