Added sanity checks for mb pointers
This commit is contained in:
parent
6d0a6b84cb
commit
e866816279
|
@ -23,6 +23,9 @@ void kmain(multiboot_info_t *mb_info, uint32_t mb_magic) {
|
|||
if (mb_magic != MULTIBOOT_BOOTLOADER_MAGIC)
|
||||
panic("Not a multiboot bootloader!");
|
||||
|
||||
if (!mb_info)
|
||||
panic("Invalid multiboot pointer");
|
||||
|
||||
print_memory_map(mb_info);
|
||||
puts("");
|
||||
print_kernel_map();
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "kernel/pmm.h"
|
||||
#include "kernel/multiboot.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
@ -26,6 +27,13 @@ static char *mem_types[] = {
|
|||
|
||||
void print_memory_map(multiboot_info_t *mb_info) {
|
||||
|
||||
if (!(mb_info->flags & MULTIBOOT_INFO_MEM_MAP)) {
|
||||
|
||||
puts("There is no info about memory map");
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
printf("Physical Memory Map:\n");
|
||||
|
||||
multiboot_memory_map_t *mmap =
|
||||
|
|
Loading…
Reference in New Issue