diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2021-04-05 14:46:31 +0200 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2021-04-05 14:46:31 +0200 |
| commit | ba7e57138c9e41cf944afb91c146fea23713c1d1 (patch) | |
| tree | 3a57bd313ee7a7fd8535286e3364ef47bb7aa705 /src/boot/boot.S | |
| parent | b54b87ad2d41e60e9be1e299140dbf59e76c8fc6 (diff) | |
Reload GDT
Diffstat (limited to 'src/boot/boot.S')
| -rw-r--r-- | src/boot/boot.S | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/boot/boot.S b/src/boot/boot.S index 746f858..e3830eb 100644 --- a/src/boot/boot.S +++ b/src/boot/boot.S @@ -1,4 +1,5 @@ .extern bringelle +.extern gdt_memcpy .globl _start .text @@ -23,5 +24,28 @@ mb_header: .long MB_ENTRY_ADDR _start: - call bringelle + +# Copy GDT into memory then load its register +call gdt_memcpy +lgdtl (GDTR) + +# Update all segments register +# with the new GDT offset +movw $0x10, %ax +movw %ax, %ds +movw %ax, %es +movw %ax, %fs +movw %ax, %gs + +# Update code segment +ljmp $0x08, $cs_new +cs_new: + +# Update stack segment +movw $0x18, %ax +movw %ax, %ss +movl $0x20000,%esp + +# Start kernel main function +call bringelle |
