From f46ab8ca2050ee77edf6e6b979875426bdaf29dc Mon Sep 17 00:00:00 2001 From: Jon Santmyer Date: Wed, 13 Mar 2024 09:58:22 -0400 Subject: fix incorrect tss rsp assignment --- arch/x86_64/syscall_setup.S | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'arch/x86_64/syscall_setup.S') diff --git a/arch/x86_64/syscall_setup.S b/arch/x86_64/syscall_setup.S index cbd3220..972e345 100644 --- a/arch/x86_64/syscall_setup.S +++ b/arch/x86_64/syscall_setup.S @@ -1,11 +1,12 @@ -.extern _kernel_thread_sp +.extern _kernel_task_sp .extern syscall_handler .global syscall_entry .type syscall_entry @function syscall_entry: + swapgs movq %rsp, %rax - movq (_kernel_thread_bp), %rsp + movq (_kernel_task_bp), %rsp pushq %rax pushq %rbp pushq %rcx @@ -16,22 +17,26 @@ syscall_entry: popq %rcx popq %rbp popq %rsp + swapgs 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 + mov $0x001b0008, %edx + wrmsr + + movq $0xc0000082, %rcx + leaq syscall_entry, %rdx + mov %edx, %eax + shr $32, %rdx wrmsr + retq -- cgit v1.2.1