Files
zinnia/arch/x86_64/archctl.c
T
2026-09-17 03:19:43 +02:00

20 lines
474 B
C

#include <zinnia/errno.h>
#include <arch/archctl.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) {
switch (op) {
case __ARCHCTL_SET_FSBASE:
asm_wrmsr(MSR_FS_BASE, arg);
return 0;
case __ARCHCTL_SET_GSBASE:
// Update the inactive GSBASE MSR, not ours.
asm_wrmsr(MSR_KERNEL_GS_BASE, arg);
return 0;
default:
return EINVAL;
}
}