diff options
author | marcus <marcus> | 2003-09-25 12:39:20 +0000 |
---|---|---|
committer | marcus <marcus> | 2003-09-25 12:39:20 +0000 |
commit | 8f6a879d9b9bd6e474d87ca81fb3cf907f009b2f (patch) | |
tree | 3ca2aded783838cec780b594c98f512a562c4644 /laden | |
parent | 426c42f1a782e97e941106c48a9b6e5768622a78 (diff) |
laden/
wortel/
2003-09-25 Marcus Brinkmann <marcus@gnu.org>
* loader.c [HAVE_CONFIG_H]: Include <config.h>.
(loader_elf_load): Rewritten architecture check of ELF binary,
support PPC now.
Diffstat (limited to 'laden')
-rw-r--r-- | laden/ChangeLog | 6 | ||||
-rw-r--r-- | laden/loader.c | 30 |
2 files changed, 30 insertions, 6 deletions
diff --git a/laden/ChangeLog b/laden/ChangeLog index c9a40a3..1116599 100644 --- a/laden/ChangeLog +++ b/laden/ChangeLog @@ -1,5 +1,11 @@ 2003-09-25 Marcus Brinkmann <marcus@gnu.org> + * loader.c [HAVE_CONFIG_H]: Include <config.h>. + (loader_elf_load): Rewritten architecture check of ELF binary, + support PPC now. + +2003-09-25 Marcus Brinkmann <marcus@gnu.org> + * elf.h: Remove cruft. 2003-09-21 Marco Gerards <metgerards@student.han.nl> diff --git a/laden/loader.c b/laden/loader.c index 54fcba7..91df2d8 100644 --- a/laden/loader.c +++ b/laden/loader.c @@ -18,6 +18,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ +#if HAVE_CONFIG_H +#include <config.h> +#endif + #include <string.h> #include "loader.h" @@ -183,15 +187,29 @@ loader_elf_load (const char *name, l4_word_t start, l4_word_t end, if (!elf->e_phoff) panic ("%s has no valid program header offset", name); -#ifdef i386 - if (elf->e_ident[EI_CLASS] != ELFCLASS32 - || elf->e_ident[EI_DATA] != ELFDATA2LSB - || elf->e_machine != EM_386) - panic ("%s is not for this architecture", name); + /* FIXME: Some architectures support both word sizes. */ + if (!((elf->e_ident[EI_CLASS] == ELFCLASS32 + && L4_WORD_SIZE == 32) + || (elf->e_ident[EI_CLASS] == ELFCLASS64 + && L4_WORD_SIZE == 64))) + panic ("%s has invalid word size", name); + if (!((elf->e_ident[EI_DATA] == ELFDATA2LSB + && L4_BYTE_ORDER == L4_LITTLE_ENDIAN) + || (elf->e_ident[EI_DATA] == ELFDATA2MSB + && L4_BYTE_ORDER == L4_BIG_ENDIAN))) + panic ("%s has invalid byte order", name); + +#if i386 +# define elf_machine EM_386 +#elif PPC +# define elf_machine EM_PPC #else -#error Not ported to this architecture! +# error Not ported to this architecture! #endif + if (elf->e_machine != elf_machine) + panic ("%s is not for this architecture", name); + for (i = 0; i < elf->e_phnum; i++) { Elf32_Phdr *ph = (Elf32_Phdr *) (start + elf->e_phoff |