[TOOLS][BUILDER] Extend Elf header checks for multiple architectures.

Based on a patch from Hollis Blanchard.
Signed-off-by: Keir Fraser <keir@xensource.com>
This commit is contained in:
kfraser@dhcp93.uk.xensource.com committed 2006-06-13 14:36:04 +01:00
1 parent 063f4cc497
commit 7758dfc719
3 files changed
+25 -12

No files matched your search

+2 -1
View File
@@ -170,13 +170,14 @@ typedef struct {
#define EM_PARISC 15 /* HPPA */
#define EM_SPARC32PLUS 18 /* Enhanced instruction set SPARC */
#define EM_PPC 20 /* PowerPC */
#define EM_PPC64 21 /* PowerPC 64-bit */
#define EM_ARM 40 /* Advanced RISC Machines ARM */
#define EM_ALPHA 41 /* DEC ALPHA */
#define EM_SPARCV9 43 /* SPARC version 9 */
#define EM_ALPHA_EXP 0x9026 /* DEC ALPHA */
#define EM_IA_64 50 /* Intel Merced */
#define EM_X86_64 62 /* AMD x86-64 architecture */
#define EM_VAX 75 /* DEC VAX */
#define EM_NUM 15 /* number of machine types */
/* Version */
#define EV_NONE 0 /* Invalid */
+22 -10
View File
@@ -22,6 +22,24 @@ loadelfsymtab(
const char *image, int xch, uint32_t dom, xen_pfn_t *parray,
struct domain_setup_info *dsi);
/*
* Elf header attributes we require for each supported host platform.
* These are checked in parseelfimage().
*/
#if defined(__ia64__)
#define ELFCLASS ELFCLASS64
#define ELFDATA ELFDATA2LSB
#define ELFMACHINE EM_IA_64
#elif defined(__i386__)
#define ELFCLASS ELFCLASS32
#define ELFDATA ELFDATA2LSB
#define ELFMACHINE EM_386
#elif defined(__x86_64__)
#define ELFCLASS ELFCLASS64
#define ELFDATA ELFDATA2LSB
#define ELFMACHINE EM_X86_64
#endif
int probe_elf(const char *image,
unsigned long image_size,
struct load_funcs *load_funcs)
@@ -61,16 +79,10 @@ static int parseelfimage(const char *image,
return -EINVAL;
}
if (
#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
(ehdr->e_ident[EI_DATA] != ELFDATA2LSB) ||
(ehdr->e_type != ET_EXEC) )
if ( (ehdr->e_ident[EI_CLASS] != ELFCLASS) ||
(ehdr->e_machine != ELFMACHINE) ||
(ehdr->e_ident[EI_DATA] != ELFDATA) ||
(ehdr->e_type != ET_EXEC) )
{
ERROR("Kernel not a Xen-compatible Elf image.");
return -EINVAL;
+1 -1
View File
@@ -178,9 +178,9 @@ typedef struct {
#define EM_ALPHA 41 /* DEC ALPHA */
#define EM_SPARCV9 43 /* SPARC version 9 */
#define EM_ALPHA_EXP 0x9026 /* DEC ALPHA */
#define EM_IA_64 50 /* Intel Merced */
#define EM_X86_64 62 /* AMD x86-64 architecture */
#define EM_VAX 75 /* DEC VAX */
#define EM_NUM 15 /* number of machine types */
/* Version */
#define EV_NONE 0 /* Invalid */
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.