#ifndef GEMMSTONE_GENERATOR_MICROKERNEL_ELF_HPP
#define GEMMSTONE_GENERATOR_MICROKERNEL_ELF_HPP
#include <cstdint>
#include "gemmstone/config.hpp"
GEMMSTONE_NAMESPACE_START
namespace microkernel {
enum {
ELFMagic = 0x464C457F, ELFClass64 = 2,
ELFLittleEndian = 1,
ELFVersion1 = 1,
ELFRelocatable = 1,
};
enum { MachineIntelGT = 205, ZebinExec = 0xFF12 };
struct FileHeader {
uint32_t magic;
uint8_t elfClass;
uint8_t endian;
uint8_t version;
uint8_t osABI;
uint64_t pad;
uint16_t type;
uint16_t machine;
uint32_t version2;
uint64_t entrypoint;
uint64_t programHeaderOff;
uint64_t sectionTableOff;
uint32_t flags;
uint16_t size;
uint16_t programHeaderSize;
uint16_t programTableEntries;
uint16_t sectionHeaderSize;
uint16_t sectionCount;
uint16_t strTableIndex;
};
struct Relocation {
uint64_t offset;
uint64_t info;
};
struct SectionHeader {
uint32_t name;
enum Type : uint32_t {
Null,
Program,
SymbolTable = 2,
StringTable = 3,
Note = 7,
Relocation = 9,
ZeInfo = 0xFF000011
} type;
uint64_t flags;
uint64_t addr;
uint64_t offset;
uint64_t size;
uint32_t link;
uint32_t info;
uint64_t alignx10;
uint64_t entrySize;
};
}
GEMMSTONE_NAMESPACE_END
#endif