Skip to content

Commit

Permalink
make sure to boot even when there are no ELF header tables (qemu -ker…
Browse files Browse the repository at this point in the history
…nel ...)
  • Loading branch information
mikaku committed Apr 29, 2022
1 parent dfac6d9 commit 8eaed51
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion kernel/multiboot.c
Expand Up @@ -148,7 +148,10 @@ static char * parse_cmdline(const char *str)
* This function returns the last address used by kernel symbols or the value
* of 'mod_end' (in the module structure) of the last module loaded by GRUB.
*
* This is intended to setup the kernel stack beyond all these addresses.
* In the case where there are no ELF header tables, then it returns the last
* .bss address plus one page.
*
* This is intended to place the kernel stack beyond all these addresses.
*/
unsigned int get_last_boot_addr(unsigned int info)
{
Expand Down Expand Up @@ -187,6 +190,11 @@ unsigned int get_last_boot_addr(unsigned int info)
}
}

/* no ELF header tables */
if(!(mbi->flags & MULTIBOOT_INFO_ELF_SHDR)) {
addr = (unsigned int)_end + PAGE_SIZE;
}

return P2V(addr);
}

Expand Down

0 comments on commit 8eaed51

Please sign in to comment.