summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitri John Ledkov <xnox@ubuntu.com>2021-05-04 20:15:00 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-05-06 15:16:29 +0200
commite706aaa7a3d6d915f4eb153075188c8642fbc452 (patch)
tree27e9b406ae89ed7ada7ad6281bcd4d5dd75e4ba1
parenttest: drop default ACL from $TESTDIR (diff)
downloadsystemd-e706aaa7a3d6d915f4eb153075188c8642fbc452.tar.xz
systemd-e706aaa7a3d6d915f4eb153075188c8642fbc452.zip
boot/efi: add ARM (THUMB) and RISCV64 machine types
Also drop defines from shared/pe-header.h, appear to be unused.
-rw-r--r--src/boot/efi/pe.c6
-rw-r--r--src/shared/pe-header.h3
2 files changed, 5 insertions, 4 deletions
diff --git a/src/boot/efi/pe.c b/src/boot/efi/pe.c
index cb35838072..e657017343 100644
--- a/src/boot/efi/pe.c
+++ b/src/boot/efi/pe.c
@@ -31,6 +31,8 @@ struct DosFileHeader {
#define PE_HEADER_MACHINE_I386 0x014c
#define PE_HEADER_MACHINE_X64 0x8664
#define PE_HEADER_MACHINE_ARM64 0xaa64
+#define PE_HEADER_MACHINE_ARM 0x01c2
+#define PE_HEADER_MACHINE_RISCV64 0x5064
struct PeFileHeader {
UINT16 Machine;
UINT16 NumberOfSections;
@@ -76,7 +78,9 @@ EFI_STATUS pe_memory_locate_sections(CHAR8 *base, CHAR8 **sections, UINTN *addrs
/* PE32+ Subsystem type */
if (pe->FileHeader.Machine != PE_HEADER_MACHINE_X64 &&
pe->FileHeader.Machine != PE_HEADER_MACHINE_ARM64 &&
- pe->FileHeader.Machine != PE_HEADER_MACHINE_I386)
+ pe->FileHeader.Machine != PE_HEADER_MACHINE_I386 &&
+ pe->FileHeader.Machine != PE_HEADER_MACHINE_ARM &&
+ pe->FileHeader.Machine != PE_HEADER_MACHINE_RISCV64)
return EFI_LOAD_ERROR;
if (pe->FileHeader.NumberOfSections > 96)
diff --git a/src/shared/pe-header.h b/src/shared/pe-header.h
index 54433c79b8..4ddfce39e6 100644
--- a/src/shared/pe-header.h
+++ b/src/shared/pe-header.h
@@ -29,9 +29,6 @@ struct DosFileHeader {
le32_t ExeHeader;
} _packed_;
-#define PE_HEADER_MACHINE_I386 0x014cU
-#define PE_HEADER_MACHINE_X64 0x8664U
-
struct PeFileHeader {
le16_t Machine;
le16_t NumberOfSections;