summaryrefslogtreecommitdiffstats
path: root/arch/x86_64/lgdt.s
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/lgdt.s')
-rw-r--r--arch/x86_64/lgdt.s26
1 files changed, 26 insertions, 0 deletions
diff --git a/arch/x86_64/lgdt.s b/arch/x86_64/lgdt.s
new file mode 100644
index 0000000..7122ef9
--- /dev/null
+++ b/arch/x86_64/lgdt.s
@@ -0,0 +1,26 @@
+.global gdt_load
+.type gdt_load @function
+gdt_load:
+ lgdt (%rdi)
+.reload_segments:
+ pushq $0x8
+ leaq .reload_cs, %rax
+ pushq %rax
+ lretq
+.reload_cs:
+ movw $0x10, %ax
+ movw %ax, %ds
+ movw %ax, %es
+ movw %ax, %fs
+ movw %ax, %gs
+ movw %ax, %ss
+ retq
+.size gdt_load, . - gdt_load
+
+.global tss_flush
+.type tss_flush @function
+tss_flush:
+ movw %di, %ax
+ ltr %ax
+ retq
+.size tss_flush, . - tss_flush