:: commit 08812292ca4615723ba85d2c3c00b73916ef85e0

monkuous <84319635+monkuous@users.noreply.github.com> — 2024-09-17 12:39

parents: 97c31196a9

protos/multiboot2: fix ordering of ALIGN_* macro parameters

diff --git a/common/protos/multiboot2.c b/common/protos/multiboot2.c
index ca9fb910..06752659 100644
--- a/common/protos/multiboot2.c
+++ b/common/protos/multiboot2.c
@@ -324,14 +324,14 @@ noreturn void multiboot2_load(char *config, char* cmdline) {
             default:
             case 0: case 1: // Prefer lowest to highest
                 reloc_ascend = true;
-                relocated_base = ALIGN_UP(reloc_tag.align, reloc_tag.min_addr);
+                relocated_base = ALIGN_UP(reloc_tag.min_addr, reloc_tag.align);
                 if (relocated_base + ranges->length > reloc_tag.max_addr) {
                     goto reloc_fail;
                 }
                 break;
             case 2: // Prefer highest to lowest
                 reloc_ascend = false;
-                relocated_base = ALIGN_DOWN(reloc_tag.align, reloc_tag.max_addr - ranges->length);
+                relocated_base = ALIGN_DOWN(reloc_tag.max_addr - ranges->length, reloc_tag.align);
                 if (relocated_base < reloc_tag.min_addr) {
                     goto reloc_fail;
                 }
tab: 248 wrap: offon