diff options
author | Jérémy Zurcher <jeremy.zurcher@heraeus.com> | 2015-11-02 11:15:48 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy.zurcher@heraeus.com> | 2015-11-02 11:15:48 +0100 |
commit | d968266a3be79c449f62fdf6f19b8f8b5344eece (patch) | |
tree | 75c3596106e4d7b92a7223adb22f4f6cb5f5f928 /kernel/gdt_asm.s | |
download | os_skeleton-d968266a3be79c449f62fdf6f19b8f8b5344eece.zip os_skeleton-d968266a3be79c449f62fdf6f19b8f8b5344eece.tar.gz |
Initial commit
Diffstat (limited to 'kernel/gdt_asm.s')
-rw-r--r-- | kernel/gdt_asm.s | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/kernel/gdt_asm.s b/kernel/gdt_asm.s new file mode 100644 index 0000000..9e59544 --- /dev/null +++ b/kernel/gdt_asm.s @@ -0,0 +1,19 @@ +%include "const.inc" + +global gdt_flush + +section .text: ; start of the text (code) section +align 4 ; the code must be 4 byte aligned + +gdt_flush: + mov eax,[esp+4] ; Get the pointer to the GDT, passed as a parameter. + lgdt [eax] ; Load the new GDT pointer + mov ax,GDT_KERNEL_DATA_SELECTOR ; offset in the GDT of the kernel data segment + mov ds,ax ; Load all data segment selectors + mov es,ax + mov fs,ax + mov gs,ax + mov ss,ax + jmp GDT_KERNEL_CODE_SELECTOR:.flush ; far jump [selector:offset] +.flush: +ret |