diff options
-rw-r--r-- | sys/include/arch/amd64/asm.h | 12 | ||||
-rw-r--r-- | sys/include/arch/amd64/msr.h | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/sys/include/arch/amd64/asm.h b/sys/include/arch/amd64/asm.h index e85dd87..04d5e42 100644 --- a/sys/include/arch/amd64/asm.h +++ b/sys/include/arch/amd64/asm.h @@ -70,6 +70,18 @@ amd64_read_gs_base(void) return rdmsr(IA32_KERNEL_GS_BASE); } +static inline void +amd64_write_fs_base(uintptr_t val) +{ + wrmsr(IA32_FS_BASE, val); +} + +static inline uintptr_t +amd64_read_fs_base(uintptr_t val) +{ + return rdmsr(IA32_FS_BASE); +} + static inline uint64_t amd64_read_cr0(void) { diff --git a/sys/include/arch/amd64/msr.h b/sys/include/arch/amd64/msr.h index d3d0c9a..fe5814b 100644 --- a/sys/include/arch/amd64/msr.h +++ b/sys/include/arch/amd64/msr.h @@ -32,6 +32,7 @@ #define IA32_SPEC_CTL 0x00000048 #define IA32_KERNEL_GS_BASE 0xC0000102 +#define IA32_FS_BASE 0xC0000100 #define IA32_APIC_BASE_MSR 0x0000001B #if !defined(__ASSEMBLER__) |