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 mov rdi, 1000 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 ret strlen: push rbx push rcx mov rbx, rdi xor al, al mov rcx, 0xffffffff repne scasb sub rdi, rbx mov rax, rdi pop rcx pop rbx dec rax ret print: ; string: rdi push rdi call strlen mov rsi, rax mov rax, 3 pop rdi int 42h ret next_line: mov rdi, newline mov rsi, 1 mov rax, 3 int 42h ret 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 "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 section .bss uname: resb 40