kernel/inc/drivers/elf/header.h

152 lines
5.5 KiB
C

// This file is part of noxos and licensed under the MIT open source license
#ifndef NOX_ELF_HEADER_H
#define NOX_ELF_HEADER_H
#include "utils/stdtypes.h"
#include "utils/string.h"
typedef enum {
ELF_ARCH_X32 = 0x01,
ELF_ARCH_X64 = 0x02,
ELF_ARCH_UNKNOWN = 0xFF
} elf_target_architecture_E;
typedef enum {
ELF_ENDIAN_LITTLE = 0x01,
ELF_ENDIAN_BIG = 0x02,
ELF_ENDIAN_UNKNOWN = 0xFF
} elf_endianness_E;
typedef enum {
ELF_SYSABI_SYSTEM_V = 0x00,
ELF_SYSABI_HP_UX = 0x01,
ELF_SYSABI_NETBSD = 0x02,
ELF_SYSABI_LINUX = 0x03,
ELF_SYSABI_GNU_HURD = 0x04,
ELF_SYSABI_SOLARIS = 0x06,
ELF_SYSABI_AIX = 0x07,
ELF_SYSABI_IRIX = 0x08,
ELF_SYSABI_FREEBSD = 0x09,
ELF_SYSABI_TRU64 = 0x0A,
ELF_SYSABI_NOVELL_MODESTO = 0x0B,
ELF_SYSABI_OPENBSD = 0x0C,
ELF_SYSABI_OPENVMS = 0x0D,
ELF_SYSABI_NONSTOP_KERNEL = 0x0E,
ELF_SYSABI_AROS = 0x0F,
ELF_SYSABI_FENIX_OS = 0x10,
ELF_SYSABI_NUXI_CLOUD_ABI = 0x11,
ELF_SYSABI_STRATUS_OPENVOS = 0x12,
ELF_SYSABI_UNKNOWN = 0xFF
} elf_sysabi_E;
typedef enum {
ELF_OBJECT_NONE = 0x00,
ELF_OBJECT_RELOCATABLE = 0x01,
ELF_OBJECT_EXECUTABLE = 0x02,
ELF_OBJECT_DYNAMIC_LIB = 0x03,
ELF_OBJECT_CORE = 0x04
} elf_object_type_E;
typedef enum {
ELF_ISA_UNDEFINED = 0x0000,
ELF_ISA_WE_32100 = 0x0001,
ELF_ISA_SPARC = 0x0002,
ELF_ISA_X86_32 = 0x0003,
ELF_ISA_MOTOROLA_68000 = 0x0004,
ELF_ISA_MOTOROLA_88000 = 0x0005,
ELF_ISA_INTEL_MCU = 0x0006,
ELF_ISA_INTEL_80860 = 0x0007,
ELF_ISA_MIPS = 0x0008,
ELF_ISA_IBM_SYSTEM_370 = 0x0009,
ELF_ISA_MIPS_RS3000_LE = 0x000A,
ELF_ISA_HP_PA_RISC = 0x000E,
ELF_ISA_INTEL_80960 = 0x0013,
ELF_ISA_POWERPC = 0x0014,
ELF_ISA_POWERPC_64 = 0x0015,
ELF_ISA_S390 = 0x0016,
ELF_ISA_IBM_SPU_SPC = 0x0017,
ELF_ISA_NEC_V800 = 0x0024,
ELF_ISA_FUJITSU_FR20 = 0x0025,
ELF_ISA_TRW_RH32 = 0x0026,
ELF_ISA_MOTOROLA_RCE = 0x0027,
ELF_ISA_ARM32 = 0x0028,
ELF_ISA_DIGITAL_ALPHA = 0x0029,
ELF_ISA_SUPER_H = 0x002A,
ELF_ISA_SPARC_V9 = 0x002B,
ELF_ISA_SIEMENS_TRICORE = 0x002C,
ELF_ISA_ARGONAUT_RISC = 0x002D,
ELF_ISA_HITACHI_H8_300 = 0x002E,
ELF_ISA_HITACHI_H8_300H = 0x002F,
ELF_ISA_HITACHI_H8S = 0x0030,
ELF_ISA_HITACHI_H8_500 = 0x0031,
ELF_ISA_IA_64 = 0x0032,
ELF_ISA_STANFORD_MIPS_X = 0x0033,
ELF_ISA_MOTOROLA_COLDFIRE = 0x0034,
ELF_ISA_MOTOROLA_68HC12 = 0x0035,
ELF_ISA_FUJITSU_MMA_ACCEL = 0x0036,
ELF_ISA_SIEMENS_PCP = 0x0037,
ELF_ISA_SONY_NCPU_RISC = 0x0038,
ELF_ISA_DENSO_NDR1 = 0x0039,
ELF_ISA_MOTOROLA_STARCORE = 0x003A,
ELF_ISA_TOYOTA_ME16 = 0x003B,
ELF_ISA_ST100 = 0x003C,
ELF_ISA_TINY_J = 0x003D,
ELF_ISA_X86_64 = 0x003E,
ELF_ISA_SONY_DSP = 0x003F,
ELF_ISA_PDP_10 = 0x0040,
ELF_ISA_PDP_11 = 0x0041,
ELF_ISA_SIEMENS_FX66 = 0x0042,
ELF_ISA_STM_ST9_PLUS = 0x0043,
ELF_ISA_STM_ST7 = 0x0044,
ELF_ISA_MOTOROLA_MC68HC16 = 0x0045,
ELF_ISA_MOTOROLA_MC68HC11 = 0x0046,
ELF_ISA_MOTOROLA_MC68HC08 = 0x0047,
ELF_ISA_MOTOROLA_MC68HC05 = 0x0048,
ELF_ISA_SGI_SVX = 0x0049,
ELF_ISA_STM_ST19 = 0x004A,
ELF_ISA_DIGITAL_VAX = 0x004B,
ELF_ISA_AXIS_EMBEDDED_32 = 0x004C,
ELF_ISA_INFINEON_EMBEDDED_32 = 0x004D,
ELF_ISA_ELEMENT_14_DSP = 0x004E,
ELF_ISA_LSI_LOGIC_16_DSP = 0x004F,
ELF_ISA_TMS_S320_C6000 = 0x008C,
ELF_ISA_MCST_ELBRUS_E2K = 0x00AF,
ELF_ISA_ARM64 = 0x00B7,
ELF_ISA_ZILOG_Z80 = 0x00DC,
ELF_ISA_RISC_V = 0x00F3,
ELF_ISA_BERKELEY_PACKET_FILTER = 0x00F7,
ELF_ISA_WDC65C816 = 0x0101,
ELF_ISA_UNKNOWN = 0xFFFF
} elf_instruction_set_E;
typedef struct {
uint8_t identity[16];
uint16_t type;
uint16_t isa;
uint32_t version;
uint64_t address_entry_point;
uint64_t offset_program_header;
uint64_t offset_section_header;
uint32_t flags;
uint16_t len_header;
uint16_t len_program_header_entry;
uint16_t num_program_header_entries;
uint16_t len_section_header_entry;
uint16_t num_section_header_entries;
uint16_t string_section_index;
} elf_header_T;
extern string_t g_elf_target_architecture_strings [3];
extern string_t g_elf_endianness_strings [3];
extern string_t g_elf_sysabi_strings [18];
extern string_t g_elf_object_type_strings [5];
extern string_t g_elf_instruction_set_strings [79];
#endif //NOX_ELF_HEADER_H