Changeset 32 for trunk/hal/x86_64/hal_init.c
- Timestamp:
- Jun 21, 2017, 11:34:09 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/x86_64/hal_init.c
r31 r32 22 22 #include <hal_types.h> 23 23 #include <hal_boot.h> 24 #include <hal_multiboot.h> 24 25 #include <hal_segmentation.h> 25 26 … … 39 40 void cpu_attach(); 40 41 41 /* -------------------------------------------------------------------------- */ 42 43 struct multiboot_info mb_info __in_kdata; 44 char mb_loader_name[PAGE_SIZE] __in_kdata; 45 uint8_t mb_mmap[PAGE_SIZE] __in_kdata; 46 47 #define offsetof(type, member) __builtin_offsetof(type, member) 48 49 50 /* -------------------------------------------------------------------------- */ 51 52 static void 53 dump_memmap() 54 { 55 size_t mmap_length = mb_info.mi_mmap_length; 56 uint8_t *mmap_addr = (uint8_t *)&mb_mmap; 57 size_t i; 58 59 if (!(mb_info.mi_flags & MULTIBOOT_INFO_HAS_MMAP)) 60 x86_printf("SHIT!!\n"); 61 62 i = 0; 63 while (i < mmap_length) { 64 struct multiboot_mmap *mm; 65 66 mm = (struct multiboot_mmap *)(mmap_addr + i); 67 68 x86_printf("-> [%Z, %Z] %s\n", mm->mm_base_addr, 69 mm->mm_base_addr + mm->mm_length, 70 (mm->mm_type == 1) ? "ram" : "rsv" ); 71 72 i += mm->mm_size + 4; 73 } 74 } 42 75 43 76 void init_x86_64(paddr_t firstpa) … … 46 79 47 80 extern uint64_t __kernel_end; 48 x86_printf("__kernel_end: % p\n", (void *)&__kernel_end);81 x86_printf("__kernel_end: %Z\n", (uint64_t)&__kernel_end); 49 82 50 83 /* Create the global structures */ … … 58 91 cpu_attach(); 59 92 x86_printf("[+] cpu_attach called\n"); 93 94 x86_printf("[+] bootloader: %s\n", mb_loader_name); 95 96 dump_memmap(); 97 98 x86_printf("[+] dump finished\n"); 60 99 61 100 char *buf = NULL;
Note: See TracChangeset
for help on using the changeset viewer.