aboutsummaryrefslogtreecommitdiff
path: root/type_elf.h
diff options
context:
space:
mode:
authorEtienne Pierre-doray <etiennep@chromium.org>2018-08-10 17:44:37 +0000
committerCopybara-Service <copybara-worker@google.com>2021-07-25 20:34:00 -0700
commite57c4e6bb4c122686c16f40e0b9d50a2e683d42b (patch)
tree2cf002c3499a23f698d92eb0ae2b51bfe9bc1606 /type_elf.h
parenta88cad0485f1c73d63ba0a1bcfccc8a68bd300c6 (diff)
downloadzucchini-e57c4e6bb4c122686c16f40e0b9d50a2e683d42b.tar.gz
[Zucchini] Create elf disassembler.
Creates Disassembler that recognises and parses ELF format. For now, it only supports Intel architeture. Support for Arm will be added in follow-up CLs. Change-Id: Ibdcf113b573f22844b6a1611c5ff6df46829b9b3 Reviewed-on: https://chromium-review.googlesource.com/1136841 Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org> Reviewed-by: Greg Thompson <grt@chromium.org> Reviewed-by: Samuel Huang <huangs@chromium.org> Cr-Commit-Position: refs/heads/master@{#582233} NOKEYCHECK=True GitOrigin-RevId: 3c64e078fea9f23e44939c25ca02cf05b72b2c40
Diffstat (limited to 'type_elf.h')
-rw-r--r--type_elf.h26
1 files changed, 24 insertions, 2 deletions
diff --git a/type_elf.h b/type_elf.h
index 99dcba2..2bbe6dc 100644
--- a/type_elf.h
+++ b/type_elf.h
@@ -67,8 +67,30 @@ struct Elf64_Ehdr {
Elf64_Half e_shstrndx;
};
+// Identification Indexes in header->e_ident.
+enum IdentificationIndex {
+ EI_MAG0 = 0, // File identification.
+ EI_MAG1 = 1, // File identification.
+ EI_MAG2 = 2, // File identification.
+ EI_MAG3 = 3, // File identification.
+ EI_CLASS = 4, // File class.
+ EI_DATA = 5, // Data encoding.
+ EI_VERSION = 6, // File version.
+ EI_OSABI = 7, // Operating system/ABI identification.
+ EI_ABIVERSION = 8, // ABI version.
+ EI_PAD = 9, // Start of padding bytes.
+ EI_NIDENT = 16 // Size of e_ident[].
+};
+
+// Values for header->e_ident[EI_CLASS].
+enum FileClass {
+ ELFCLASSNONE = 0, // Invalid class.
+ ELFCLASS32 = 1, // 32-bit objects.
+ ELFCLASS64 = 2 // 64-bit objects.
+};
+
// Values for header->e_type.
-enum e_type_values {
+enum FileType {
ET_NONE = 0, // No file type
ET_REL = 1, // Relocatable file
ET_EXEC = 2, // Executable file
@@ -79,7 +101,7 @@ enum e_type_values {
};
// Values for header->e_machine.
-enum e_machine_values {
+enum MachineArchitecture {
EM_NONE = 0, // No machine.
EM_386 = 3, // Intel Architecture.
EM_ARM = 40, // ARM Architecture.