aboutsummaryrefslogtreecommitdiff
path: root/kernel/gdt-as.S
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/gdt-as.S')
-rw-r--r--kernel/gdt-as.S16
1 files changed, 16 insertions, 0 deletions
diff --git a/kernel/gdt-as.S b/kernel/gdt-as.S
new file mode 100644
index 0000000..7283dc8
--- /dev/null
+++ b/kernel/gdt-as.S
@@ -0,0 +1,16 @@
+ .global gdt_flush
+ .type gdt_flush, @function
+gdt_flush: # prototype: void gdt_flush(uint32_t addr)
+ cli
+ movl 4(%esp), %eax # load the address off the stack (first param)
+ lgdt (%eax)
+ mov $0x10, %ax
+ mov %ax, %ds
+ mov %ax, %es
+ mov %ax, %fs
+ mov %ax, %gs
+ mov %ax, %ss
+ sti
+ jmp .flush
+.flush:
+ ret