about summary refs log tree commit diff stats
path: root/kernel.soso/gdt.asm
diff options
context:
space:
mode:
Diffstat (limited to 'kernel.soso/gdt.asm')
-rw-r--r--kernel.soso/gdt.asm30
1 files changed, 30 insertions, 0 deletions
diff --git a/kernel.soso/gdt.asm b/kernel.soso/gdt.asm
new file mode 100644
index 00000000..54c01cfa
--- /dev/null
+++ b/kernel.soso/gdt.asm
@@ -0,0 +1,30 @@
+[GLOBAL flushGdt]
+
+flushGdt:
+    mov eax, [esp+4] ;[esp+4] is the parametered passed
+    lgdt [eax]
+
+    mov ax, 0x10  ;0x10 is the offset to our data segment
+    mov ds, ax
+    mov es, ax
+    mov fs, ax
+    mov gs, ax
+    mov ss, ax
+    jmp 0x08:.flush ;0x08 is the offset to our code segment
+.flush:
+    ret
+
+[GLOBAL flushIdt]
+
+flushIdt:
+    mov eax, [esp+4] ;[esp+4] is the parametered passed
+    lidt [eax]
+    ret
+
+[GLOBAL flushTss]
+
+flushTss:
+    mov ax, 0x2B ;index of the TSS structure is 0x28 (5*8) and OR'ing two bits in order to set RPL 3 and we get 0x2B
+
+    ltr ax
+    ret