Changeset 270 for trunk/kernel/libk/elf.c
- Timestamp:
- Jul 21, 2017, 3:56:36 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/libk/elf.c
r265 r270 40 40 static bool_t elf_isValidHeader(Elf_Ehdr *header) 41 41 { 42 if((header->e_ident[EI_CLASS] == ELFCLASS 32)42 if((header->e_ident[EI_CLASS] == ELFCLASS) 43 43 && (header->e_ident[EI_DATA] == ELFDATA2LSB) 44 44 && (header->e_ident[EI_VERSION] == EV_CURRENT) 45 /* 45 46 && (header->e_ident[EI_OSABI] == ELFOSABI_NONE) 47 */ 46 48 && ((header->e_machine == EM_MIPS) || 47 49 (header->e_machine == EM_MIPS_RS3_LE) || … … 50 52 return true; 51 53 52 if( header->e_ident[EI_CLASS] != ELFCLASS 32)53 printk("\n[ERROR] in %s : Elf is not 32 -Binary\n", __FUNCTION__ );54 if( header->e_ident[EI_CLASS] != ELFCLASS ) 55 printk("\n[ERROR] in %s : Elf is not 32/64-Binary\n", __FUNCTION__ ); 54 56 55 57 if( header->e_ident[EI_DATA] != ELFDATA2LSB ) … … 58 60 if( header->e_ident[EI_VERSION] != EV_CURRENT ) 59 61 printk("\n[ERROR] in %s : Elf is not in Current Version\n", __FUNCTION__); 60 62 /* 61 63 if( header->e_ident[EI_OSABI] != ELFOSABI_NONE ) 62 64 printk("\n[ERROR] in %s : Unexpected Elf ABI, need UNIX System V ABI\n", __FUNCTION__ ); 63 64 if( (header->e_machine == EM_MIPS) ||65 (header->e_machine == EM_MIPS_RS3_LE) ||66 (header->e_machine == EM_X86_64) )65 */ 66 if( (header->e_machine != EM_MIPS) && 67 (header->e_machine != EM_MIPS_RS3_LE) && 68 (header->e_machine != EM_X86_64) ) 67 69 printk("\n[ERROR] in %s : unexpected core / accept only MIPS or x86_64\n", __FUNCTION__ ); 68 70 69 if( header->e_type == ET_EXEC )71 if( header->e_type != ET_EXEC ) 70 72 printk("\n[ERROR] in %s : Elf is not executable binary\n", __FUNCTION__ ); 71 73
Note: See TracChangeset
for help on using the changeset viewer.