git: e0c3f66b4d5f - main - stand/efi: Call md_copymodules based on __LP64__ to fix 32-bit arm

From: Warner Losh <imp_at_FreeBSD.org>
Date: Sun, 23 Oct 2022 01:48:21 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=e0c3f66b4d5f0282e9c7c4803c4cd26b5a388a38

commit e0c3f66b4d5f0282e9c7c4803c4cd26b5a388a38
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2022-10-23 01:09:10 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-10-23 01:47:25 +0000

    stand/efi: Call md_copymodules based on __LP64__ to fix 32-bit arm
    
    When I refactored everything, I neglected to pass in the proper is64
    value on 32-bit platforms. This corrects that. This prevented armv7 and
    armv6 platforms from booting due to misaligned data in the kernel.  The
    only platform we support 32-bit booting in armv[67], which I apparently
    neglected to test before commiting my refactoring.
    
    Tested by:              skibo
    Fixes:                  5d1531d9d4e7d
    Sponsored by:           Netflix
    Differential Revision:  https://reviews.freebsd.org/D37095
---
 stand/efi/loader/bootinfo.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/stand/efi/loader/bootinfo.c b/stand/efi/loader/bootinfo.c
index 558f7bdae91e..38175bf10bc5 100644
--- a/stand/efi/loader/bootinfo.c
+++ b/stand/efi/loader/bootinfo.c
@@ -316,6 +316,7 @@ bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp, bool exit_bs)
 	vm_offset_t size;
 	char *rootdevname;
 	int howto;
+	bool is64;
 #if defined(LOADER_FDT_SUPPORT)
 	vm_offset_t dtbp;
 	int dtb_size;
@@ -335,6 +336,11 @@ bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp, bool exit_bs)
 #endif
 	};
 #endif
+#ifdef __LP64__
+	is64 = true;
+#else
+	is64 = false;
+#endif
 
 	howto = bi_getboothowto(args);
 
@@ -413,7 +419,7 @@ bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp, bool exit_bs)
 #endif
 	bi_load_efi_data(kfp, exit_bs);
 
-	size = md_copymodules(0, true);
+	size = md_copymodules(0, is64);
 	kernend = roundup(addr + size, PAGE_SIZE);
 	*kernendp = kernend;
 
@@ -438,7 +444,7 @@ bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp, bool exit_bs)
 #endif
 
 	/* Copy module list and metadata. */
-	(void)md_copymodules(addr, true);
+	(void)md_copymodules(addr, is64);
 
 	return (0);
 }