Changeset 270 for trunk/kernel


Ignore:
Timestamp:
Jul 21, 2017, 3:56:36 PM (7 years ago)
Author:
max@…
Message:

Comment out EI_OSABI, and use ELFCLASS.

Location:
trunk/kernel/libk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/libk/elf.c

    r265 r270  
    4040static bool_t elf_isValidHeader(Elf_Ehdr *header)
    4141{
    42         if((header->e_ident[EI_CLASS] == ELFCLASS32)
     42        if((header->e_ident[EI_CLASS] == ELFCLASS)
    4343           && (header->e_ident[EI_DATA] == ELFDATA2LSB)
    4444           && (header->e_ident[EI_VERSION] == EV_CURRENT)
     45/*
    4546           && (header->e_ident[EI_OSABI] == ELFOSABI_NONE)
     47*/
    4648           && ((header->e_machine == EM_MIPS) ||
    4749               (header->e_machine == EM_MIPS_RS3_LE) ||
     
    5052                return true;
    5153
    52         if( header->e_ident[EI_CLASS] != ELFCLASS32 )
    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__ );
    5456
    5557        if( header->e_ident[EI_DATA] != ELFDATA2LSB )
     
    5860        if( header->e_ident[EI_VERSION] != EV_CURRENT )
    5961                printk("\n[ERROR] in %s : Elf is not in Current Version\n", __FUNCTION__);
    60 
     62/*
    6163        if( header->e_ident[EI_OSABI] != ELFOSABI_NONE )
    6264                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) )
    6769                printk("\n[ERROR] in %s : unexpected core / accept only MIPS or x86_64\n", __FUNCTION__ );
    6870
    69         if( header->e_type == ET_EXEC )
     71        if( header->e_type != ET_EXEC )
    7072                printk("\n[ERROR] in %s : Elf is not executable binary\n", __FUNCTION__ );
    7173
  • trunk/kernel/libk/elf.h

    r227 r270  
    104104#define ELFCLASSNONE    0               /* Invalid class */
    105105#define ELFCLASS32      1               /* 32-bit objects */
     106#define ELFCLASS64      2       /* 64-bit objects */
     107
    106108#define ELFCLASSNUM     3
    107109
     
    209211#define Elf_Ehdr  Elf32_Ehdr
    210212#define Elf_Phdr  Elf32_Phdr
     213#define ELFCLASS  ELFCLASS32
    211214#elif defined (HAL_64BIT)
    212215#define Elf_Half  Elf64_Half
     
    217220#define Elf_Ehdr  Elf64_Ehdr
    218221#define Elf_Phdr  Elf64_Phdr
     222#define ELFCLASS  ELFCLASS64
    219223#else
    220224#error "Must define HAL_64BIT/HAL_32BIT"
Note: See TracChangeset for help on using the changeset viewer.