diff options
author | Marvin Borner | 2021-07-07 19:13:11 +0200 |
---|---|---|
committer | Marvin Borner | 2021-07-07 19:13:11 +0200 |
commit | 9a2d5cbdc7972d1d5bfb1ea93f82f66d113faa17 (patch) | |
tree | 08ceb8427b64a08c89a5526dfbf8b66c78f9d12c /src/loader/jmp.asm | |
parent | 6355c3e08c9f4d3db122252abce5837c364d5b81 (diff) |
Strange implementations
Diffstat (limited to 'src/loader/jmp.asm')
-rw-r--r-- | src/loader/jmp.asm | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/loader/jmp.asm b/src/loader/jmp.asm new file mode 100644 index 0000000..f591dda --- /dev/null +++ b/src/loader/jmp.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 |