From 55166f9d5f37f4a12893a23b9b068e23c0267eac Mon Sep 17 00:00:00 2001 From: kamkow1 Date: Wed, 14 Jan 2026 21:21:20 +0100 Subject: [PATCH] syscall doesn't need RPL 3 bits on kernel code --- init/init.c | 3 +++ kernel/amd64/syscall.c | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/init/init.c b/init/init.c index b0f2a78..1f62c71 100644 --- a/init/init.c +++ b/init/init.c @@ -25,4 +25,7 @@ void app_main (void) { proc_mutex_lock (mutex_rid); proc_test ('b'); proc_mutex_unlock (mutex_rid); + + for (;;) + ; } diff --git a/kernel/amd64/syscall.c b/kernel/amd64/syscall.c index e59cbf2..22e0859 100644 --- a/kernel/amd64/syscall.c +++ b/kernel/amd64/syscall.c @@ -34,8 +34,7 @@ int amd64_syscall_dispatch (void* stack_ptr) { } void syscall_init (void) { - amd64_wrmsr (MSR_STAR, - ((uint64_t)(GDT_KCODE | 0x03) << 32) | ((uint64_t)(GDT_KDATA | 0x03) << 48)); + amd64_wrmsr (MSR_STAR, ((uint64_t)GDT_KCODE << 32) | ((uint64_t)(GDT_KDATA | 0x03) << 48)); amd64_wrmsr (MSR_LSTAR, (uint64_t)&amd64_syscall_entry); amd64_wrmsr (MSR_SYSCALL_MASK, (1ULL << 9)); amd64_wrmsr (MSR_EFER, amd64_rdmsr (MSR_EFER) | EFER_SCE);