ia32: Use explicitly sized types for multiboot structs
The multiboot specification states that these fields are 32bits in sized, not the size of machine pointer or integer.
This commit is contained in:
parent
cf53dfa1e7
commit
01e39adb66
2 changed files with 16 additions and 15 deletions
|
|
@ -19,9 +19,9 @@
|
|||
#include <types.h>
|
||||
|
||||
typedef struct multiboot_module {
|
||||
paddr_t start;
|
||||
paddr_t end;
|
||||
char* name;
|
||||
uint32_t start;
|
||||
uint32_t end;
|
||||
uint32_t name;
|
||||
uint32_t reserved;
|
||||
} multiboot_module_t;
|
||||
|
||||
|
|
@ -30,9 +30,9 @@ typedef struct multiboot_info {
|
|||
uint32_t mem_lower;
|
||||
uint32_t mem_upper;
|
||||
uint32_t boot_device;
|
||||
char* cmdline;
|
||||
uint32_t cmdline;
|
||||
uint32_t mod_count;
|
||||
multiboot_module_t* mod_list;
|
||||
uint32_t mod_list;
|
||||
/* the multiboot spec includes more fields we don't need */
|
||||
} multiboot_info_t;
|
||||
|
||||
|
|
|
|||
|
|
@ -433,6 +433,7 @@ try_boot_sys(
|
|||
paddr_t load_paddr;
|
||||
unsigned int i;
|
||||
p_region_t ui_p_regs;
|
||||
multiboot_module_t *modules = (multiboot_module_t*)mbi->mod_list;
|
||||
|
||||
glks.num_nodes = 1; /* needed to enable console output */
|
||||
|
||||
|
|
@ -440,7 +441,7 @@ try_boot_sys(
|
|||
printf("Boot loader not multiboot compliant\n");
|
||||
return false;
|
||||
}
|
||||
cmdline_parse(mbi->cmdline, &cmdline_opt);
|
||||
cmdline_parse((const char *)mbi->cmdline, &cmdline_opt);
|
||||
|
||||
/* assert correct NDKS location and size */
|
||||
assert((uint32_t)_ndks_start == PPTR_NDKS);
|
||||
|
|
@ -557,17 +558,17 @@ try_boot_sys(
|
|||
printf(
|
||||
" module #%d: start=0x%x end=0x%x size=0x%x name='%s'\n",
|
||||
i,
|
||||
mbi->mod_list[i].start,
|
||||
mbi->mod_list[i].end,
|
||||
mbi->mod_list[i].end - mbi->mod_list[i].start,
|
||||
mbi->mod_list[i].name
|
||||
modules[i].start,
|
||||
modules[i].end,
|
||||
modules[i].end - modules[i].start,
|
||||
modules[i].name
|
||||
);
|
||||
if ((int32_t)(mbi->mod_list[i].end - mbi->mod_list[i].start) <= 0) {
|
||||
if ((int32_t)(modules[i].end - modules[i].start) <= 0) {
|
||||
printf("Invalid boot module size! Possible cause: boot module file not found by QEMU\n");
|
||||
return false;
|
||||
}
|
||||
if (mods_end_paddr < mbi->mod_list[i].end) {
|
||||
mods_end_paddr = mbi->mod_list[i].end;
|
||||
if (mods_end_paddr < modules[i].end) {
|
||||
mods_end_paddr = modules[i].end;
|
||||
}
|
||||
}
|
||||
mods_end_paddr = ROUND_UP(mods_end_paddr, PAGE_BITS);
|
||||
|
|
@ -583,7 +584,7 @@ try_boot_sys(
|
|||
|
||||
for (i = 0; i < mbi->mod_count && i < glks.num_nodes; i++) {
|
||||
printf(" module #%d for node #%d: ", i, i);
|
||||
load_paddr = load_boot_module(i, mbi->mod_list + i, load_paddr);
|
||||
load_paddr = load_boot_module(i, modules + i, load_paddr);
|
||||
if (!load_paddr) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -591,7 +592,7 @@ try_boot_sys(
|
|||
|
||||
for (i = mbi->mod_count; i < glks.num_nodes; i++) {
|
||||
printf(" module #%d for node #%d: ", mbi->mod_count - 1, i);
|
||||
load_paddr = load_boot_module(i, mbi->mod_list + mbi->mod_count - 1, load_paddr);
|
||||
load_paddr = load_boot_module(i, modules + mbi->mod_count - 1, load_paddr);
|
||||
if (!load_paddr) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue