X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/32b9a6d76790c73d3d2d36d9081a2581cc65d184..28c176b668c841a3b7fb093faccf0efa39257603:/lunaix-os/arch/x86/exec/elf64.c diff --git a/lunaix-os/arch/x86/exec/elf64.c b/lunaix-os/arch/x86/exec/elf64.c new file mode 100644 index 0000000..4bc9058 --- /dev/null +++ b/lunaix-os/arch/x86/exec/elf64.c @@ -0,0 +1,14 @@ +#include + +#define EM_X86_64 62 + +int +elf_check_arch(const struct elf* elf) +{ + const struct elf_ehdr* ehdr = &elf->eheader; + + return *(u32_t*)(ehdr->e_ident) == ELFMAGIC_LE && + ehdr->e_ident[EI_CLASS] == ELFCLASS64 && + ehdr->e_ident[EI_DATA] == ELFDATA2LSB && + ehdr->e_machine == EM_X86_64; +} \ No newline at end of file