summaryrefslogtreecommitdiffhomepage
path: root/src/loader/jumper.asm
diff options
context:
space:
mode:
authorMarvin Borner2021-07-12 18:14:44 +0200
committerMarvin Borner2021-07-12 18:15:29 +0200
commit1b429c0fc28e5cd8b474ad5a1de1fa6f3d7c2e2a (patch)
tree593af3e3ec78795bb47553f492db07fb7e87e373 /src/loader/jumper.asm
parentd414d2f6f46bd425d727af5baae3e2658d6e1384 (diff)
Renamed files to match presentation
Diffstat (limited to 'src/loader/jumper.asm')
-rw-r--r--src/loader/jumper.asm28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/loader/jumper.asm b/src/loader/jumper.asm
new file mode 100644
index 0000000..f591dda
--- /dev/null
+++ b/src/loader/jumper.asm
@@ -0,0 +1,28 @@
+; MIT License, Copyright (c) 2021 Marvin Borner
+; Exit the bootloader and clear registers
+
+bits 32
+
+; Empty (invalid) idt
+idt:
+ dd 0, 0
+
+global jmp_kernel
+jmp_kernel:
+ cli ; Disable interrupts because of invalid idt
+ lidt [idt] ; Load empty (invalid) idt
+
+ xor eax, eax
+ lldt ax ; Clear LDT by pointing to nothing
+
+ add esp, 4
+ pop edi
+ add esp, 4
+
+ mov eax, 0x00000001
+ mov cr0, eax ; Clear cr0 except protected mode
+
+ xor eax, eax
+ mov cr4, eax ; Clear cr4 completely
+
+ call edi ; Call custom (specified) jumper