37 lines
618 B
C
37 lines
618 B
C
#pragma once
|
|
|
|
#include "../../types.h"
|
|
|
|
[[packed]]
|
|
struct Elf64_Ehdr {
|
|
c8 e_ident[16];
|
|
u16 e_type;
|
|
u16 e_machine;
|
|
u32 e_version;
|
|
u64 e_entry;
|
|
u64 e_phoff;
|
|
u64 e_shoff;
|
|
u32 e_flags;
|
|
u16 e_ehsize;
|
|
u16 e_phentsize;
|
|
u16 e_phnum;
|
|
u16 e_shentsize;
|
|
u16 e_shentnum;
|
|
u16 e_shstrndx;
|
|
};
|
|
|
|
[[packed]]
|
|
struct Elf64_Phdr {
|
|
u32 p_type;
|
|
u32 p_flags;
|
|
u64 p_offset;
|
|
u64 p_vaddr;
|
|
u64 p_paddr;
|
|
u64 p_filesz;
|
|
u64 p_memsz;
|
|
u64 p_align;
|
|
};
|
|
|
|
/// We don't have space to allocate memory, so we have no idea where we can pass back ELF state, we'll have to do this all at once
|
|
int ElfExecute(void* Binary, void* LoadAddr);
|