This commit is contained in:
2026-09-25 15:39:16 +02:00
committed by Marvin Friedrich
parent b9ee87aed4
commit 6e92817f3f
35 changed files with 271 additions and 157 deletions
+17 -4
View File
@@ -1,19 +1,32 @@
#include <zinnia/errno.h>
#include <zinnia/syscall.h>
#include <arch/archctl.h>
#include <arch/mem.h>
#include <uapi/archctl.h>
#include <x86_64/asm.h>
#include <x86_64/defs.h>
errno_t arch_archctl(uintptr_t op, uintptr_t arg) {
struct syscall_ret arch_archctl(uintptr_t op, uintptr_t arg) {
struct syscall_ret ret = {};
switch (op) {
case __ARCHCTL_SET_FSBASE:
if (!arch_mem_addr_is_user(arg)) {
ret.errno = EINVAL;
return ret;
}
asm_wrmsr(MSR_FS_BASE, arg);
return 0;
return ret;
case __ARCHCTL_SET_GSBASE:
if (!arch_mem_addr_is_user(arg)) {
ret.errno = EINVAL;
return ret;
}
// Update the inactive GSBASE MSR, not ours.
asm_wrmsr(MSR_KERNEL_GS_BASE, arg);
return 0;
return ret;
default:
return EINVAL;
ret.errno = EINVAL;
return ret;
}
}