Skip to content

Commit 7b6ea22

Browse files
committed
multiboot: make sure heap ends up after cmdline
1 parent f5e4f02 commit 7b6ea22

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/kernel/multiboot.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ extern "C" {
2525

2626
extern uintptr_t _end;
2727

28-
// Function to deterimine the end of multiboot provided data
28+
// Deterimine the end of multiboot provided data
2929
// (e.g. multiboot's data area as offset to the _end symbol)
3030
uintptr_t _multiboot_free_begin(uintptr_t boot_addr){
3131

@@ -34,8 +34,12 @@ extern "C" {
3434

3535
if (bootinfo->flags & MULTIBOOT_INFO_CMDLINE
3636
and bootinfo->cmdline > multi_end) {
37-
debug("* Multiboot cmdline end: 0x%x \n", bootinfo->cmdline);
38-
multi_end = bootinfo->cmdline;
37+
38+
debug("* Multiboot cmdline @ 0x%x: %s \n", bootinfo->cmdline, (char*)bootinfo->cmdline);
39+
40+
// Set free begin to after the cmdline string
41+
multi_end = bootinfo->cmdline +
42+
strlen(reinterpret_cast<const char*>(bootinfo->cmdline)) + 1;
3943
}
4044

4145
debug("* Multiboot end: 0x%x \n", multi_end);

0 commit comments

Comments
 (0)