From bc33f9dd8749f9f7df469c00c41acb8ed610d6e4 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Wed, 3 Mar 2021 00:09:10 +0800 Subject: [PATCH] efi/riscv64: Fix NumberOfRvaAndSizes of PE header The riscv64 UEFI executable has inconsistent header and therefore cannot be loaded by the EDK2 implementation of UEFI. Apparently Uboot doesn't care about this detail but EDK2 validates it. Specifically NumberOfRvaAndSizes should be the number of data directory entries. It is set to 6 but there are actually 16. (All entries below NumberOfRvaAndSizes until section_table) This was probably a typo 0x6 -> 16 (or 0x10). This is the check of EDK2: https://github.com/tianocore/edk2/blob/stable/202011/MdePkg/Library/BasePeCoffLib/BasePeCoff.c#L313-L321 Fixes #16824 Change-Id: I5c0dc080cb1cd191b44e016298656db9edd9ca8d Reviewed-on: https://review.haiku-os.org/c/haiku/+/3761 Reviewed-by: X512 Reviewed-by: Alex von Gluck IV --- src/system/boot/platform/efi/arch/riscv64/crt0-efi-riscv64.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/system/boot/platform/efi/arch/riscv64/crt0-efi-riscv64.S b/src/system/boot/platform/efi/arch/riscv64/crt0-efi-riscv64.S index 94bc71c2b5..70206e8326 100644 --- a/src/system/boot/platform/efi/arch/riscv64/crt0-efi-riscv64.S +++ b/src/system/boot/platform/efi/arch/riscv64/crt0-efi-riscv64.S @@ -87,7 +87,7 @@ extra_header_fields: .quad 0 // SizeOfHeapReserve .quad 0 // SizeOfHeapCommit .long 0 // LoaderFlags - .long 0x6 // NumberOfRvaAndSizes + .long 16 // NumberOfRvaAndSizes .quad 0 // ExportTable .quad 0 // ImportTable