summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorJari Vetoniemi <mailroxas@gmail.com>2017-05-01 23:13:54 +0300
committerJari Vetoniemi <mailroxas@gmail.com>2017-05-01 23:19:29 +0300
commit46c749b54b73140543f31f36674af993aa121107 (patch)
tree52a1e5300cd3485bc55bc5ccefa7542bb8ab8375 /spec
parent29086b1d12a2c28cffdbfbf0b3990a7bd75506b9 (diff)
Add elf.fspec
Needs union support to be implemented fully.
Diffstat (limited to 'spec')
-rw-r--r--spec/elf.fspec26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/elf.fspec b/spec/elf.fspec
new file mode 100644
index 0000000..d107f85
--- /dev/null
+++ b/spec/elf.fspec
@@ -0,0 +1,26 @@
+struct elf64 {
+ e_entry: u64;
+ e_phoff: u64;
+ e_shoff: u64;
+};
+
+struct elf {
+ ei_magic: u8[4] | matches('\x7fELF') str;
+ ei_class: u8 hex; // word size
+ ei_data: u8 hex; // endianess
+ ei_version: u8;
+ ei_osabi: u8;
+ ei_abi_version: u8;
+ padding: u8[7] nul;
+ e_type: u16 hex;
+ e_machine: u16 hex;
+ e_version: u32;
+ elf64: struct elf64; // fspec needs union to parse ei_class != 2 type
+ e_flags: u32 hex;
+ e_ehsz: u16;
+ e_phentsize: u16;
+ e_phnum: u16;
+ e_shentsize: u16;
+ e_shnum: u16;
+ e_shstrndx: u16;
+};