Changeset 9e5938dc in mainline for generic/src/lib/elf32.c


Ignore:
Timestamp:
2006-03-05T13:30:31Z (19 years ago)
Author:
Sergey Bondari <bondari@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bc314be8
Parents:
bd21922
Message:

ELF framework for all archs. SPARC V9 not tested to compile.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • generic/src/lib/elf32.c

    rbd21922 r9e5938dc  
    2727 */
    2828
    29 #include <elf32.h>
     29#include <elf.h>
    3030
    3131/** 32bit ELF loader
     
    3636 */
    3737int elf32_load(__address header, as_t * as) {
    38         return EE_UNSUPPORTED;
     38        elf32_header_t * e_header;
     39
     40        e_header = (elf32_header_t *) header;
     41       
     42        /* Identify ELF */
     43        if (    e_header->e_ident[EI_MAG0] != ELFMAG0 || e_header->e_ident[EI_MAG1] != ELFMAG1 ||
     44                e_header->e_ident[EI_MAG2] != ELFMAG2 || e_header->e_ident[EI_MAG3] != ELFMAG3
     45                ) {
     46                return EE_INVALID;
     47        }
     48       
     49        /* Identify ELF compatibility */
     50        if (    e_header->e_ident[EI_DATA] != ELF_DATA_ENCODING || e_header->e_machine != ELF_MACHINE ||
     51                e_header->e_ident[EI_VERSION] != EV_CURRENT || e_header->e_ident[EI_CLASS] != ELF_CLASS
     52                ) {
     53                return EE_UNSUPPORTED;
     54        }
     55       
     56
     57        return EE_UNSUPPORTED; 
    3958}
Note: See TracChangeset for help on using the changeset viewer.