diff options
author | Jon Santmyer <jon@jonsantmyer.com> | 2024-03-11 21:30:31 -0400 |
---|---|---|
committer | Jon Santmyer <jon@jonsantmyer.com> | 2024-03-11 21:30:31 -0400 |
commit | d1ff7bcc91886626dc9060ec5fb67ee102ab7c1d (patch) | |
tree | 8f0b5cd8aad31089131785dc6e37b659490f9955 /arch/x86_64/syscall_setup.S | |
download | jove-kernel-d1ff7bcc91886626dc9060ec5fb67ee102ab7c1d.tar.gz jove-kernel-d1ff7bcc91886626dc9060ec5fb67ee102ab7c1d.tar.bz2 jove-kernel-d1ff7bcc91886626dc9060ec5fb67ee102ab7c1d.zip |
usermode capable kernel with logging syscall
Diffstat (limited to 'arch/x86_64/syscall_setup.S')
-rw-r--r-- | arch/x86_64/syscall_setup.S | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/arch/x86_64/syscall_setup.S b/arch/x86_64/syscall_setup.S new file mode 100644 index 0000000..cbd3220 --- /dev/null +++ b/arch/x86_64/syscall_setup.S @@ -0,0 +1,37 @@ +.extern _kernel_thread_sp +.extern syscall_handler + +.global syscall_entry +.type syscall_entry @function +syscall_entry: + movq %rsp, %rax + movq (_kernel_thread_bp), %rsp + pushq %rax + pushq %rbp + pushq %rcx + pushq %r11 + movq %rsp, %rbp + call syscall_handler + popq %r11 + popq %rcx + popq %rbp + popq %rsp + sysretq + +.global syscall_setup_syscall +.type syscall_setup_syscall @function +syscall_setup_syscall: + movq $0xc0000082, %rcx + leaq syscall_entry, %rdx + mov %edx, %eax + shr $32, %rdx + wrmsr + movq $0xc0000080, %rcx + rdmsr + or $1, %eax + wrmsr + movq $0xc0000081, %rcx + rdmsr + mov $0x00180008, %edx + wrmsr + retq |