aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/arch/x86_64/load_desc.asm
diff options
context:
space:
mode:
authorEmulatedSeasons <89668582+EmulatedSeasons@users.noreply.github.com>2024-05-10 01:44:59 -0400
committerEmulatedSeasons <89668582+EmulatedSeasons@users.noreply.github.com>2024-05-10 01:44:59 -0400
commit975a9ec96e282e437ccc1bdf1e660dcbf4542791 (patch)
tree29bdbd7769d59df82c6bace1d653c8be310c2d08 /kernel/arch/x86_64/load_desc.asm
parentabaab98bd757cd0818cfcddc983eee25ab7672ed (diff)
Added GDT and basic IDT as well as a bitmap drawing function
Diffstat (limited to 'kernel/arch/x86_64/load_desc.asm')
-rw-r--r--kernel/arch/x86_64/load_desc.asm29
1 files changed, 29 insertions, 0 deletions
diff --git a/kernel/arch/x86_64/load_desc.asm b/kernel/arch/x86_64/load_desc.asm
new file mode 100644
index 0000000..df65c72
--- /dev/null
+++ b/kernel/arch/x86_64/load_desc.asm
@@ -0,0 +1,29 @@
+; GDT and IDT loading routines
+
+section .text
+global load_gdt:function
+load_gdt:
+ lgdt [rdi]
+ ret
+
+global reload_segments:function
+reload_segments:
+ ; reload cs register
+ push 0x08
+ lea rax, [rel .reload_cs]
+ push rax
+ retfq
+
+.reload_cs:
+ mov ax, 0x10
+ mov ds, ax
+ mov es, ax
+ mov fs, ax
+ mov gs, ax
+ mov ss, ax
+ ret
+
+global load_idt:function
+load_idt:
+ lidt [rdi]
+ ret \ No newline at end of file