summaryrefslogtreecommitdiff
path: root/include/pe.h
diff options
context:
space:
mode:
authorIvan Gorinov <ivan.gorinov@intel.com>2018-04-05 18:32:06 -0700
committerAlexander Graf <agraf@suse.de>2018-04-06 09:28:01 +0200
commit61a5ced6ad9376a0755ea2a920667e3a9072990c (patch)
tree2770f93a3032f95b0e959849209d7e4e231364fb /include/pe.h
parent0c5d2a3dac01a8d436639ab5b7e44f4218d62b84 (diff)
efi_loader: Check machine type in the image header
Check FileHeader.Machine to make sure the EFI executable image is built for the same architecture. For example, 32-bit U-Boot on x86 will print an error message instead of loading an x86_64 image and crashing. Signed-off-by: Ivan Gorinov <ivan.gorinov@intel.com> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'include/pe.h')
-rw-r--r--include/pe.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/pe.h b/include/pe.h
index c3a19cef76..e7845bb7d2 100644
--- a/include/pe.h
+++ b/include/pe.h
@@ -38,11 +38,15 @@ typedef struct _IMAGE_DOS_HEADER {
#define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */
#define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
+#define IMAGE_FILE_MACHINE_I386 0x014c
#define IMAGE_FILE_MACHINE_ARM 0x01c0
#define IMAGE_FILE_MACHINE_THUMB 0x01c2
#define IMAGE_FILE_MACHINE_ARMNT 0x01c4
#define IMAGE_FILE_MACHINE_AMD64 0x8664
#define IMAGE_FILE_MACHINE_ARM64 0xaa64
+#define IMAGE_FILE_MACHINE_RISCV32 0x5032
+#define IMAGE_FILE_MACHINE_RISCV64 0x5064
+
#define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
#define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
#define IMAGE_SUBSYSTEM_EFI_APPLICATION 10