git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add lunaix dynamic linker as submodule
[lunaix-os.git]
/
lunaix-os
/
kernel
/
exe
/
elf32
/
elf32bfmt.c
diff --git
a/lunaix-os/kernel/exe/elf32/elf32bfmt.c
b/lunaix-os/kernel/exe/elf32/elf32bfmt.c
index 451c3946bd915dd23b5d0eaa631c092901f50a92..8d2814330ad72d66ba8c52791bc63297b68e39ed 100644
(file)
--- a/
lunaix-os/kernel/exe/elf32/elf32bfmt.c
+++ b/
lunaix-os/kernel/exe/elf32/elf32bfmt.c
@@
-164,12
+164,19
@@
elf32_read_phdr(struct elf32* elf)
}
int
}
int
-elf32_check_exec(const struct elf32* elf)
+elf32_check_exec(const struct elf32* elf, int type)
+{
+ const struct elf32_ehdr* ehdr = &elf->eheader;
+
+ return (ehdr->e_entry) && ehdr->e_type == type;
+}
+
+int
+elf32_check_arch(const struct elf32* elf)
{
const struct elf32_ehdr* ehdr = &elf->eheader;
return *(u32_t*)(ehdr->e_ident) == ELFMAGIC &&
ehdr->e_ident[EI_CLASS] == ELFCLASS32 &&
{
const struct elf32_ehdr* ehdr = &elf->eheader;
return *(u32_t*)(ehdr->e_ident) == ELFMAGIC &&
ehdr->e_ident[EI_CLASS] == ELFCLASS32 &&
- ehdr->e_ident[EI_DATA] == ELFDATA2LSB && ehdr->e_
type == ET_EXEC &&
- ehdr->e_machine == EM_386;
-}
+ ehdr->e_ident[EI_DATA] == ELFDATA2LSB && ehdr->e_
machine == EM_386;
+}
\ No newline at end of file