aboutsummaryrefslogtreecommitdiff
path: root/src/boot/multiboot2.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/boot/multiboot2.cc')
-rw-r--r--src/boot/multiboot2.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/boot/multiboot2.cc b/src/boot/multiboot2.cc
index bac1adb..da247ad 100644
--- a/src/boot/multiboot2.cc
+++ b/src/boot/multiboot2.cc
@@ -4,13 +4,12 @@
#include "libs/stdio.hpp"
u32* mb2_find_tag(u32 *mb2_info_addr, char type){
- PAGING_MAP(mb2_info_addr);
- u32 size=(u32)mb2_info_addr[0]; // Todo: check for size
- for(u64 i=0;i<size/8;i++)
- PAGING_MAP(mb2_info_addr+i*4096);
+ PAGE_MAP(mb2_info_addr);
+ u32 size=(u32)VIRT(mb2_info_addr)[0]; // Todo: check for size
+ PAGE_RMAP(mb2_info_addr, size);
- char *location=((char*)mb2_info_addr)+8; // Goto first tag
- char *start=(char*)mb2_info_addr;
+ char *location=((char*)VIRT(mb2_info_addr))+8; // Goto first tag
+ char *start=(char*)VIRT(mb2_info_addr);
while((location-start) < size){
// Goto next 64bit align address
@@ -23,6 +22,10 @@ u32* mb2_find_tag(u32 *mb2_info_addr, char type){
if(cur_type==type){
return (u32*)location;
}
+ if(type > 30){
+ printk("Strange multiboot infos structure...\n");
+ return 0;
+ }
location+=cur_size;
}