tiny_os/root/root.S

27 lines
519 B
ArmAsm
Raw Normal View History

2024-06-16 23:39:04 +08:00
.macro syscall msg ptr
li a0, \msg
li a1, \ptr
ecall
.endm
.text
.global _start
_start:
la t0, msg
.loop:
lb a2, 0(t0)
2024-07-03 22:51:21 +08:00
beqz a2, .yield
# msg: label = DebugPutChar(1), length = 3
2024-06-17 00:43:42 +08:00
# ptr: self-referential to cspace, just to create a valid cptr
syscall (1<<12 | 3), 0x0202020202020202
2024-06-16 23:39:04 +08:00
addi t0, t0, 1
j .loop
2024-07-03 22:51:21 +08:00
.yield:
# msg: label = Yield(2), length = 2
# ptr: self-referential to cspace, just to create a valid cptr
syscall (2<<12 | 2), 0x0202020202020202
j _start
2024-06-16 23:39:04 +08:00
.data
msg : .string "Hello, world!\n\0"