From aecadf65c4d3dea68e55605ff5f0c3eb90206488 Mon Sep 17 00:00:00 2001
From: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
Date: Fri, 27 Mar 2015 08:01:41 -0700
Subject: [PATCH 1/7] pe32.h: add header structures for TE and DOS executables

Upstream-Status: Inappropriate [embedded specific]

Add header structures to describe the Terse Executable format and
the DOS header format for executable images.

These definitions are needed in subsequent commits to parse and
verify the identity of the executable image when utilizing a shim
to boot LUV.

Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
---
 include/grub/efi/pe32.h | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/include/grub/efi/pe32.h b/include/grub/efi/pe32.h
index c3efa9b..c1c3483 100644
--- a/include/grub/efi/pe32.h
+++ b/include/grub/efi/pe32.h
@@ -313,4 +313,40 @@ struct grub_pe32_reloc
 #define GRUB_PE32_REL_I386_DIR32	0x6
 #define GRUB_PE32_REL_I386_REL32	0x14
 
+struct grub_te_header
+{
+  grub_uint16_t                    signature;
+  grub_uint16_t                    machine;
+  grub_uint8_t                     num_sections;
+  grub_uint8_t                     subsystem;
+  grub_uint16_t                    stripped_size;
+  grub_uint32_t                    entry_point;
+  grub_uint32_t                    code_base;
+  grub_uint64_t                    image_base;
+  struct grub_pe32_data_directory  data_directory[2];
+};
+
+struct grub_dos_header
+{
+  grub_uint16_t magic;
+  grub_uint16_t cblp;
+  grub_uint16_t cp;
+  grub_uint16_t crlc;
+  grub_uint16_t cparhdr;
+  grub_uint16_t minalloc;
+  grub_uint16_t maxalloc;
+  grub_uint16_t ss;
+  grub_uint16_t sp;
+  grub_uint16_t csum;
+  grub_uint16_t ip;
+  grub_uint16_t cs;
+  grub_uint16_t lfarlc;
+  grub_uint16_t ovno;
+  grub_uint16_t res[4];
+  grub_uint16_t oemid;
+  grub_uint16_t oeminfo;
+  grub_uint16_t res2[10];
+  grub_uint32_t lfanew;
+};
+
 #endif /* ! GRUB_EFI_PE32_HEADER */
-- 
1.9.1

