Use the new syscalls in init

This commit is contained in:
apio 2022-10-01 17:32:50 +02:00
parent ac6fdce737
commit c7f46f96ff

View File

@ -1,6 +1,13 @@
section .text section .text
global _start global _start
_start: _start:
call gettid
cmp rax, 0
jne .continue ; shenanigans: init is tid 0 (which is normally reserved for the idle task)
mov rdi, shenanigans_label
call print
jmp .end
.continue:
mov rdi, welcome_label mov rdi, welcome_label
call print call print
call next_line call next_line
@ -8,13 +15,23 @@ _start:
call sleep call sleep
mov rdi, version_label mov rdi, version_label
call print call print
call get_version
mov rdi, uname
call print
call next_line
call next_line call next_line
mov rdi, 2000 mov rdi, 2000
call sleep call sleep
mov rdi, end_label mov rdi, end_label
call print call print
.end:
call exit call exit
gettid:
mov rax, 7
int 42h
ret
sleep: sleep:
mov rax, 2 mov rax, 2
int 42h int 42h
@ -54,12 +71,25 @@ exit:
mov rax, 0 mov rax, 0
int 42h int 42h
get_version:
mov rdi, uname
mov rsi, 40
mov rax, 6
int 42h
ret
section .rodata section .rodata
version_label: version_label:
db "You are running Luna version v0.7-beta", 0xA, 0 db "Your kernel version is ", 0
welcome_label: welcome_label:
db "Welcome to Luna!", 0xA, 0 db "Welcome to Luna!", 0xA, 0
end_label: end_label:
db "Press any key to restart.", 0xA, 0 db "Press any key to restart.", 0xA, 0
shenanigans_label:
db "SHENANIGANS: init is tid 0 (reserved for the idle task)", 0xA, 0
newline: newline:
db 0xA db 0xA
section .bss
uname:
resb 40