Added the skeleton for the machine types.
This commit is contained in:
+9
-3
@@ -1,5 +1,6 @@
|
||||
#include "elf_header.h"
|
||||
#include "elf_osabi.h"
|
||||
#include "elf_machine_type.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -19,8 +20,8 @@ typedef enum EIdent
|
||||
EI_CLASS = 4,
|
||||
EI_DATA = 5,
|
||||
EI_HEADER_VERSION = 6,
|
||||
EI_OSABI = 7,
|
||||
EI_ABIVERSION = 8,
|
||||
EI_OSABI = ELF_OSABI_IDENT_INDEX,
|
||||
EI_ABIVERSION = ELF_OSABI_VERSION_IDENT_INDEX,
|
||||
EI_PAD = 9,
|
||||
EI_NIDENT = ELF_IDENTITIFCATION_MAX_SIZE - 1, //End of reserved 16 bytes for the header.
|
||||
EI_TYPE = EI_NIDENT + 1,
|
||||
@@ -87,12 +88,17 @@ struct elf_header* ParseObjectFile(const char* bytes, size_t count) {
|
||||
if (bytes[EI_HEADER_VERSION] == 1) printf("ELF File Version: Current (1)\n");
|
||||
else printf("ELF File Version: Invalid (%d)\n", bytes[EI_HEADER_VERSION]);
|
||||
|
||||
char buffer[255];
|
||||
char buffer[256];
|
||||
|
||||
GetELFOSABIString(bytes[EI_OSABI], buffer);
|
||||
|
||||
printf("OS ABI: %s\n", buffer);
|
||||
|
||||
GetELFMachineTypeText(bytes[EI_MACHINE], buffer);
|
||||
|
||||
printf("Machine type: %s\n", buffer);
|
||||
printf("Machine: %d\n", bytes[EI_MACHINE]);
|
||||
|
||||
// int64_t entryAddress;
|
||||
|
||||
// memcpy(&entryAddress, &bytes[EI_ENTRY_ADDRESS_POINT], sizeof(int64_t));
|
||||
|
||||
Reference in New Issue
Block a user