Skip to content

Commit

Permalink
arch/x86: Correct multiboot interpretation when building for EFI
Browse files Browse the repository at this point in the history
When loaded via EFI, we obviously don't have a multiboot info pointer
available (we might have an EFI system table, but zefi doesn't pass
that through yet).  Don't try to parse the "whatever garbage was in
%rbp" as a multiboot table.

The configuration is a little clumsy, as strictly our EFI kconfig just
says we're "building for" EFI but not that we'll boot that way.  And
tests like arch/x86/info are trying to set CONFIG_MULTIBOOT=n
unconditionally, when it really should be something they detect from
devicetree or wherever.

Fixes #33545

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
  • Loading branch information
Andy Ross authored and nashif committed May 15, 2021
1 parent 653e7a2 commit 41e8859
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion arch/x86/core/prep_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ FUNC_NORETURN void z_x86_prep_c(void *arg)
x86_64_irq_init();
#endif

#ifdef CONFIG_MULTIBOOT_INFO
#if defined(CONFIG_MULTIBOOT_INFO) && !defined(CONFIG_BUILD_OUTPUT_EFI)
z_multiboot_init(info);
#else
ARG_UNUSED(info);
Expand Down
2 changes: 1 addition & 1 deletion tests/arch/x86/info/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ project(x86_info)

target_sources(app PRIVATE src/main.c)
target_sources(app PRIVATE src/timer.c)
target_sources(app PRIVATE src/memmap.c)
target_sources_ifdef(CONFIG_ACPI app PRIVATE src/acpi.c)
target_sources_ifdef(CONFIG_MULTIBOOT app PRIVATE src/multiboot.c)
target_sources_ifdef(CONFIG_X86_MEMMAP app PRIVATE src/memmap.c)
1 change: 1 addition & 0 deletions tests/arch/x86/info/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ CONFIG_MULTIBOOT_MEMMAP=y
CONFIG_MULTIBOOT_FRAMEBUF=y
CONFIG_COUNTER=y
CONFIG_COUNTER_CMOS=y
CONFIG_X86_MEMMAP=y
5 changes: 5 additions & 0 deletions tests/arch/x86/info/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ __weak void multiboot(void)
printk("MULTIBOOT: Not supported in this build.\n\n");
}

__weak void memmap(void)
{
printk("MEMMAP: Not supported in this build.\n\n");
}

__weak void acpi(void)
{
printk("ACPI: Not supported in this build.\n\n");
Expand Down

0 comments on commit 41e8859

Please sign in to comment.