From c7f46f96ffa83c2b7bc774058a66f45d4d1445b2 Mon Sep 17 00:00:00 2001 From: apio Date: Sat, 1 Oct 2022 17:32:50 +0200 Subject: [PATCH] Use the new syscalls in init --- apps/init.asm | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/apps/init.asm b/apps/init.asm index 67d4feb3..d44fcc99 100644 --- a/apps/init.asm +++ b/apps/init.asm @@ -1,6 +1,13 @@ section .text global _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 call print call next_line @@ -8,13 +15,23 @@ _start: call sleep mov rdi, version_label call print + call get_version + mov rdi, uname + call print + call next_line call next_line mov rdi, 2000 call sleep mov rdi, end_label call print +.end: call exit +gettid: + mov rax, 7 + int 42h + ret + sleep: mov rax, 2 int 42h @@ -54,12 +71,25 @@ exit: mov rax, 0 int 42h +get_version: + mov rdi, uname + mov rsi, 40 + mov rax, 6 + int 42h + ret + section .rodata version_label: - db "You are running Luna version v0.7-beta", 0xA, 0 + db "Your kernel version is ", 0 welcome_label: db "Welcome to Luna!", 0xA, 0 end_label: db "Press any key to restart.", 0xA, 0 +shenanigans_label: + db "SHENANIGANS: init is tid 0 (reserved for the idle task)", 0xA, 0 newline: - db 0xA \ No newline at end of file + db 0xA + +section .bss +uname: + resb 40 \ No newline at end of file