summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-07-29 01:28:58 -0400
committerIan Moffett <ian@osmora.org>2024-07-29 01:28:58 -0400
commit6b6133186d9eb1fb076e63013b1ed3bdaebea973 (patch)
tree5b7a7367f6a7ee3ae99a733740db470bc9d8c365
parent3f6a668013d3c5b18d11ad5f10b1b56ff74d9424 (diff)
kernel/amd64: Facilitate IA32_FS_BASE reads/writes
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r--sys/include/arch/amd64/asm.h12
-rw-r--r--sys/include/arch/amd64/msr.h1
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__)