Skip to content

Commit

Permalink
hw: Fix multiboot flag parsing
Browse files Browse the repository at this point in the history
MULTIBOOT_MEMORY_INFO should be MULTIBOOT_INFO_MEMORY, these are two
different things.

Multiboot command line should only be used if MULTIBOOT_INFO_CMDLINE is
present.
  • Loading branch information
mato committed Jun 29, 2015
1 parent c370a8b commit 0af7bef
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions platform/hw/multiboot.c
Expand Up @@ -80,14 +80,18 @@ bmk_multiboot(struct multiboot_info *mbi)
bmk_printf("rump kernel bare metal multibootstrap\n\n");

/* save the command line before something overwrites it */
cmdline = (char *)(uintptr_t)mbi->cmdline;
cmdlinelen = bmk_strlen(cmdline);
if (cmdlinelen >= BMK_MULTIBOOT_CMDLINE_SIZE)
bmk_platform_halt("command line too long, "
"increase BMK_MULTIBOOT_CMDLINE_SIZE");
bmk_strcpy(bmk_multiboot_cmdline, cmdline);

if ((mbi->flags & MULTIBOOT_MEMORY_INFO) == 0)
if (mbi->flags & MULTIBOOT_INFO_CMDLINE) {
cmdline = (char *)(uintptr_t)mbi->cmdline;
cmdlinelen = bmk_strlen(cmdline);
if (cmdlinelen >= BMK_MULTIBOOT_CMDLINE_SIZE)
bmk_platform_halt("command line too long, "
"increase BMK_MULTIBOOT_CMDLINE_SIZE");
bmk_strcpy(bmk_multiboot_cmdline, cmdline);
}
else
bmk_multiboot_cmdline[0] = 0;

if ((mbi->flags & MULTIBOOT_INFO_MEMORY) == 0)
bmk_platform_halt("multiboot memory info not available\n");

if (parsemem(mbi->mmap_addr, mbi->mmap_length) != 0)
Expand Down

0 comments on commit 0af7bef

Please sign in to comment.