some modify
This commit is contained in:
30
elf.c
Executable file
30
elf.c
Executable file
@@ -0,0 +1,30 @@
|
||||
#include "elf.h"
|
||||
#include "text.h"
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
|
||||
void run(char *elfdata) {
|
||||
if (elfdata[EI_CLASS] == ELFCLASS32) {
|
||||
Elf32_Ehdr elf32header;
|
||||
CopyMem(&elf32header, elfdata, sizeof(elf32header));
|
||||
if (!IS_ELF(elf32header)) {
|
||||
print("This is not ELF file!");
|
||||
}
|
||||
if (elf32header.e_ident[EI_OSABI] != ELFOSABI_LINUX &&
|
||||
elf32header.e_ident[EI_OSABI] != ELFOSABI_NONE) {
|
||||
print("This ELF file is not valid OS ABI!");
|
||||
}
|
||||
if (elf32header.e_machine != EM_386 &&
|
||||
elf32header.e_machine != EM_486 &&
|
||||
elf32header.e_machine != EM_X86_64) {
|
||||
print("This ELF file is not for x86 or x86_64!");
|
||||
}
|
||||
if (elf32header.e_type == ET_REL) {
|
||||
} else if (elf32header.e_type == ET_EXEC) {
|
||||
} else if (elf32header.e_type == ET_DYN) {
|
||||
}
|
||||
|
||||
} else if (elfdata[EI_CLASS] == ELFCLASS64) {
|
||||
Elf64_Ehdr elf64header;
|
||||
CopyMem(&elf64header, elfdata, sizeof(elf64header));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user