:: commit f5c449ac00aa9d1c5ac350e8b2ca07216e34d166

Philipp Schuster <philipp.schuster@cyberus-technology.de> — 2024-01-31 15:15

parents: 395e23f29e

multiboot2: don't fail on 0x9 tag when 0x3 is available

A kernel can define multiple entries. Even if they are marked as required,
it makes no sense to panic when there is a valid and expected alternative.

Further, this aligns the behavior with GRUB2.

This solution is however simple, as it expects that all tags appear in
natural order. However, every developer that is sane will order them
naturally.
diff --git a/common/protos/multiboot2.c b/common/protos/multiboot2.c
index b4eca3ed..fb2e4490 100644
--- a/common/protos/multiboot2.c
+++ b/common/protos/multiboot2.c
@@ -206,6 +206,12 @@ noreturn void multiboot2_load(char *config, char* cmdline) {
                 reloc_tag = *reloc_tag_ptr;
                 break;
             }
+            case MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI64: {
+                if (entry_point == 0xffffffff /* no alternative entry */) {
+                    panic(true, "multiboot2: required EFI AMD64 entry tag is unsupported and no alternative entry was found\n");
+                }
+                break;
+            }
 
             default:
                 if (is_required)
tab: 248 wrap: offon