WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ppc-devel

[XenPPC] [pushed] [ppc] improve ELF header checking to include PPCisms

To: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Subject: [XenPPC] [pushed] [ppc] improve ELF header checking to include PPCisms
From: jimix@xxxxxxxxxxxxxx
Date: Mon, 15 May 2006 17:50:16 -0400
Delivery-date: Mon, 15 May 2006 14:48:31 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
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

<Prev in Thread] Current Thread [Next in Thread>
  • [XenPPC] [pushed] [ppc] improve ELF header checking to include PPCisms, jimix <=