Luna/kernel/src/main.asm

24 lines
506 B
NASM
Raw Normal View History

global _main
extern _start
_main:
xor rbp, rbp
call _start
global _userspace
_userspace:
mov rdi, 4000 ; 4000 ms / 4 seconds
int 33h ; Sleep
2022-09-27 17:51:01 +00:00
mov rcx, 10
.loop:
dec rcx
mov rdi, .message
int 32h ; Print string
2022-09-27 17:51:01 +00:00
mov rdi, 200 ; 200 ms / 0.2 seconds
int 33h ; Sleep
2022-09-27 17:51:01 +00:00
cmp rcx, 0
jne .loop
cli ; WE ARE IN RING 3!! So this should GPF and the kernel should exit us as "misbehaved"
int 31h ; Exit current task
.message:
db "hello from userspace!", 0xA, 0