Verify if the e820 call is valid

This commit is contained in:
Baptiste Wicht 2013-10-31 13:44:11 +01:00
parent aa747b988f
commit ca5c11023c

View File

@ -53,13 +53,14 @@ e820_mmap:
.e820f: .e820f:
mov [e820_entry_count], bp mov [e820_entry_count], bp
clc clc
popa
ret
.failed: .failed:
stc stc
popa popa
ret ret
_start: _start:
@ -72,6 +73,8 @@ _start:
cli cli
call e820_mmap call e820_mmap
setc al
mov [e820_failed], al
; Load GDT ; Load GDT
lgdt [GDTR64] lgdt [GDTR64]
@ -145,10 +148,12 @@ pm_start:
[BITS 64] [BITS 64]
lm_start: lm_start:
movzx r8, word [e820_entry_count] movzx r8, byte [e820_failed]
call set_current_position call set_current_position
call print_int_normal call print_int_normal
jmp $
; Install IDT ; Install IDT
call install_idt call install_idt
@ -212,12 +217,15 @@ GDTR64:
dw 4 * 8 - 1 ; Length of GDT dw 4 * 8 - 1 ; Length of GDT
dd GDT64 dd GDT64
e820_memory_map: e820_failed:
times 32 dq 0, 0, 0 db 0
e820_entry_count: e820_entry_count:
dw 0 dw 0
e820_memory_map:
times 32 dq 0, 0, 0
; Fill the sector (not necessary, but cleaner) ; Fill the sector (not necessary, but cleaner)
times 16384-($-$$) db 0 times 16384-($-$$) db 0