summaryrefslogtreecommitdiffstats
path: root/arch/x86_64/syscall_setup.S
diff options
context:
space:
mode:
authorJon Santmyer <jon@jonsantmyer.com>2024-03-13 09:58:22 -0400
committerJon Santmyer <jon@jonsantmyer.com>2024-03-13 09:58:22 -0400
commitf46ab8ca2050ee77edf6e6b979875426bdaf29dc (patch)
tree1877f76c37adc4c7f7ea98a24f2cd1a61432ac63 /arch/x86_64/syscall_setup.S
parentd1ff7bcc91886626dc9060ec5fb67ee102ab7c1d (diff)
downloadjove-kernel-f46ab8ca2050ee77edf6e6b979875426bdaf29dc.tar.gz
jove-kernel-f46ab8ca2050ee77edf6e6b979875426bdaf29dc.tar.bz2
jove-kernel-f46ab8ca2050ee77edf6e6b979875426bdaf29dc.zip
fix incorrect tss rsp assignment
Diffstat (limited to 'arch/x86_64/syscall_setup.S')
-rw-r--r--arch/x86_64/syscall_setup.S21
1 files changed, 13 insertions, 8 deletions
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