summaryrefslogtreecommitdiffhomepage
path: root/src/loader/jmp.asm
blob: f591ddacc62da154c7f37cd8d277dd96033da276 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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