let's see if magic enum can work part1

This commit is contained in:
georgemoralis 2023-04-18 11:33:53 +03:00
parent 02cefec599
commit 53f504bd41
2 changed files with 15 additions and 3 deletions

View File

@ -222,7 +222,7 @@ bool Elf::isElfFile() const
return false; return false;
} }
if (m_elf_header->e_type != ET_DYNEXEC && m_elf_header->e_type != ET_DYNAMIC) if (m_elf_header->e_type != ET_SCE_DYNEXEC && m_elf_header->e_type != ET_SCE_DYNAMIC)
{ {
printf("ERROR:e_type expected 0xFE10 OR 0xFE18 is (%04x)\n", m_elf_header->e_type); printf("ERROR:e_type expected 0xFE10 OR 0xFE18 is (%04x)\n", m_elf_header->e_type);
return false; return false;
@ -302,7 +302,7 @@ void Elf::DebugDump() {
} }
spdlog::info("\n"); spdlog::info("\n");
spdlog::info(" type .........: {:#06x}\n", m_elf_header->e_type); //spdlog::info(" type .........: {:#06x}\n", m_elf_header->e_type);
spdlog::info(" machine .......: {:#06x}\n", m_elf_header->e_machine); spdlog::info(" machine .......: {:#06x}\n", m_elf_header->e_machine);
spdlog::info(" version .......: {:#010x}\n", m_elf_header->e_version); spdlog::info(" version .......: {:#010x}\n", m_elf_header->e_version);

View File

@ -61,13 +61,25 @@ constexpr u08 ELFABIVERSION_AMDGPU_HSA_V2 = 0;
constexpr u16 ET_DYNEXEC = 0xFE10; // Executable file constexpr u16 ET_DYNEXEC = 0xFE10; // Executable file
constexpr u16 ET_DYNAMIC = 0xFE18; // Shared constexpr u16 ET_DYNAMIC = 0xFE18; // Shared
typedef enum : u16 {
ET_NONE = 0x0,
ET_REL = 0x1,
ET_EXEC = 0x2,
ET_DYN = 0x3,
ET_CORE = 0x4,
ET_SCE_EXEC = 0xfe00,
ET_SCE_STUBLIB = 0xfe0c,
ET_SCE_DYNEXEC = 0xfe10,
ET_SCE_DYNAMIC = 0xfe18
} e_type_s;
//machine field //machine field
constexpr u16 EM_X86_64 = 62; // Advanced Micro Devices X86-64 processor constexpr u16 EM_X86_64 = 62; // Advanced Micro Devices X86-64 processor
struct elf_header struct elf_header
{ {
u08 e_ident[16]; /* ELF identification */ u08 e_ident[16]; /* ELF identification */
u16 e_type; /* Object file type */ e_type_s e_type; /* Object file type */
u16 e_machine; /* Machine type */ u16 e_machine; /* Machine type */
u32 e_version; /* Object file version */ u32 e_version; /* Object file version */
u64 e_entry; /* Entry point address */ u64 e_entry; /* Entry point address */