Implement syscalls, hello world from userspace

This commit is contained in:
2025-09-02 23:51:14 +02:00
parent 920de10025
commit 8a12f23b69
24 changed files with 313 additions and 44 deletions

View File

@ -0,0 +1,48 @@
#include "regs.S"
.extern hal_syscalldispatch
.global hal_enable_syscallentry
hal_enable_syscallentry:
movq $0xC0000080, %rcx
rdmsr
or $0x1, %eax
wrmsr
movq $0xC0000081, %rcx
rdmsr
movl $0x180008, %edx
wrmsr
ret
.global hal_syscallentry
hal_syscallentry:
cli
swapgs
movq %rsp, %gs:0x8
movq %gs:0x0, %rsp
pushq $0x23
pushq %gs:0x8
swapgs
pushq %r11
pushq $0x1b
pushq %rcx
_push_regs
mov %rsp, %rdi
mov $0x0, %rbp
call hal_syscalldispatch
cli
_pop_regs
popq %rcx
add $0x8, %rsp
popq %r11
popq %rsp
sysret