[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [XenPPC] [pushed] [ppc] improve ELF header checking to include PPCisms
changeset: 10274:4e549c41ea11c380d671623913b9bc5e3afb6ec1 user: jimix@xxxxxxxxxxxxxxxxxxxxx date: Mon May 15 17:02:44 2006 -0400 files: tools/libxc/xc_load_elf.c description: [ppc] improve ELF header checking to include PPCisms diff -r 112c81301316ddaf8c02b34e948666a4575051c8 -r 4e549c41ea11c380d671623913b9bc5e3afb6ec1 tools/libxc/xc_load_elf.c --- a/tools/libxc/xc_load_elf.c Mon May 15 17:02:02 2006 -0400 +++ b/tools/libxc/xc_load_elf.c Mon May 15 17:02:44 2006 -0400 @@ -13,6 +13,7 @@ #include "xc_elf.h" #include <stdlib.h> +#include <endian.h> #define round_pgup(_p) (((_p)+(PAGE_SIZE-1))&PAGE_MASK) #define round_pgdown(_p) ((_p)&PAGE_MASK) @@ -70,14 +71,29 @@ static int parseelfimage(const char *ima } if ( +#if ELFSIZE == 32 + (ehdr->e_ident[EI_CLASS] != ELFCLASS32) || +#elif ELFSIZE == 64 + (ehdr->e_ident[EI_CLASS] != ELFCLASS64) || +#endif #if defined(__i386__) - (ehdr->e_ident[EI_CLASS] != ELFCLASS32) || (ehdr->e_machine != EM_386) || #elif defined(__x86_64__) - (ehdr->e_ident[EI_CLASS] != ELFCLASS64) || (ehdr->e_machine != EM_X86_64) || -#endif +#elif defined(__powerpc__) +#if ELFSIZE == 32 + (ehdr->e_machine != EM_PPC) || +#elif ELFSIZE == 64 + (ehdr->e_machine != EM_PPC64) || +#endif +#endif +#if __BYTE_ORDER == __LITTLE_ENDIAN (ehdr->e_ident[EI_DATA] != ELFDATA2LSB) || +#elif __BYTE_ORDER == __BIG_ENDIAN + (ehdr->e_ident[EI_DATA] != ELFDATA2MSB) || +#else +#error "Byte order unknown" +#endif (ehdr->e_type != ET_EXEC) ) { ERROR("Kernel not a Xen-compatible Elf image."); _______________________________________________ Xen-ppc-devel mailing list Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-ppc-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |