Added a dedicated file for handling the OS ABI values.

This commit is contained in:
2024-04-09 23:31:33 -05:00
parent b40418d357
commit 3a452b0922
6 changed files with 76 additions and 183 deletions
+10
View File
@@ -1,4 +1,5 @@
#include "elf_header.h"
#include "elf_osabi.h"
#include <stdio.h>
#include <string.h>
@@ -83,6 +84,15 @@ struct elf_header* ParseObjectFile(const char* bytes, size_t count) {
printf("Data: Unknown byte order\n");
}
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];
GetELFOSABIString(bytes[EI_OSABI], buffer);
printf("OS ABI: %s\n", buffer);
// int64_t entryAddress;
// memcpy(&entryAddress, &bytes[EI_ENTRY_ADDRESS_POINT], sizeof(int64_t));