elf.h
ubixos/types.h
ubixos/sched.h
src/sys/kernel/elf.c
src/sys/kernel/exec.c
src/sys/kernel/ld.c
src/sys/kernel/syscall.c
src/sys/kmods/kmod.c
sys/thread.h
ubixos/sched.h
ubixos/types.h
sys/_types.h
vfs/file.h
sys/tss.h
vfs/mount.h
ubixfs/dirCache.h
src/sys/include/ubixos/elf.h
ubixos/tty.h
src/sys/kernel/elf.c
src/sys/kmods/kmod.c
src/sys/kernel/ld.c
src/sys/kernel/syscall.c
src/sys/include/ubixos/elf.h
src/sys/kernel/exec.c
Elf_Auxargs
elfDynamic
elfDynSym
elfHeader
elfPltInfo
elfProgramHeader
elfSectionHeader
ELF32_R_INFO
s
t
((s)<<8+(unsigned char)(t))
ELF32_R_SYM
i
((i)>>8)
kmod_load
ldEnable
ELF32_R_TYPE
i
((unsigned char)(i))
kmod_load
ldEnable
elfExecutable
0x002
elfLibrary
0x003
EM_386
3
EM_68K
4
EM_860
7
EM_88K
5
EM_M32
1
EM_MIPS
8
EM_NONE
0
EM_SPARC
2
ET_CORE
4
ET_DYN
3
elf_loadfile
ET_EXEC
2
elf_loadfile
sys_exec
ET_HIPROC
0xffff
ET_LOPROC
0xff00
ET_NONE
0
ET_REL
1
EV_CURRENT
1
EV_NONE
0
PT_DYNAMIC
2
kmod_load
ldEnable
sysExec
PT_GNU_EH_FRAME
0x6474e550
PT_GNU_RELRO
(PT_LOOS + 0x474e552)
PT_GNU_STACK
(PT_LOOS + 0x474e551)
kmod_load
ldEnable
PT_HIOS
0x6fffffff
PT_HIPROC
0x7fffffff
PT_INTERP
3
sys_exec
sysExec
PT_LOAD
1
elf_loadfile
kmod_load
ldEnable
sys_exec
sysExec
PT_LOOS
0x60000000
PT_LOPROC
0x70000000
PT_NOTE
4
PT_NULL
0
PT_PAX_FLAGS
(PT_LOOS + 0x5041580)
kmod_load
ldEnable
PT_PHDR
6
sys_exec
PT_SHLIB
5
R_386_32
1
kmod_load
ldEnable
R_386_COPY
5
R_386_GLOB_DAT
6
R_386_GOT32
3
R_386_GOTOFF
9
R_386_GOTPC
10
R_386_JMP_SLOT
7
R_386_NONE
0
R_386_PC32
2
kmod_load
ldEnable
R_386_PLT32
4
R_386_RELATIVE
8
kmod_load
ldEnable
int int elf_loadfile (kTask_t *p, const char *file, uint32_t *addr, uint32_t *entry) elf_loadfile kTask_t * p const char * file uint32_t * addr uint32_t * entry _current elfHeader::eEntry elfHeader::eIdent elfHeader::ePhnum elfHeader::ePhoff ET_DYN ET_EXEC elfHeader::eType fclose fopen fread fseek taskStruct::id K_PANIC kfree kmalloc kprintf memset PAGE_DEFAULT PAGE_PRESENT PAGE_USER elfProgramHeader::phMemsz elfProgramHeader::phVaddr PT_LOAD vmm_remapPage vmm_setPageAttributes vmmFindFreePage x1000
char * char* elfGetPhType (int) elfGetPhType int elfPhType phTypeName
char * char* elfGetRelType (int) elfGetRelType int elfRelType relTypeName kmod_load ldEnable
char * char* elfGetShType (int) elfGetShType int elfShType shTypeName

    /*****************************************************************************************
    Copyright(c)2002-2004TheUbixOSProject
    Allrightsreserved.

    Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are
    permittedprovidedthatthefollowingconditionsaremet:

    Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof
    conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary
    formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing
    disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided
    withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits
    contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware
    withoutspecificpriorwrittenpermission.

    THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY
    EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF
    MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL
    THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,
    SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT
    OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION)
    HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR
    TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS
    SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE.

    $Id: elf_8h.xml 88 2016-01-12 00:11:29Z reddawg $

    *****************************************************************************************/

    #ifndef_ELF_H
    #define_ELF_H

    #include<ubixos/types.h>
    #include<ubixos/sched.h>

    #defineelfExecutable0x002
    #defineelfLibrary0x003

    #defineR_386_NONE0/*nonenone*/
    #defineR_386_321/*word32S+A*/
    #defineR_386_PC322/*word32S+A-P*/
    #defineR_386_GOT323/*word32G+A-P*/
    #defineR_386_PLT324/*word32L+A-P*/
    #defineR_386_COPY5/*nonenone*/
    #defineR_386_GLOB_DAT6/*word32S*/
    #defineR_386_JMP_SLOT7/*word32S*/
    #defineR_386_RELATIVE8/*word32B+A*/
    #defineR_386_GOTOFF9/*word32S+A-GOT*/
    #defineR_386_GOTPC10/*word32GOT+A-P*/

    /*ElfTypes*/
    #defineET_NONE0//Nofiletype
    #defineET_REL1//Relocatablefile
    #defineET_EXEC2//Executablefile
    #defineET_DYN3//Sharedobjectfile
    #defineET_CORE4//Corefile
    #defineET_LOPROC0xff00//Processor-specific
    #defineET_HIPROC0xffff
    /*EndElfTypes*/

    /*ElfMachineTypes*/
    #defineEM_NONE0//Nomachine
    #defineEM_M321//AT&TWE32100
    #defineEM_SPARC2//SPARC
    #defineEM_3863//Intel80386
    #defineEM_68K4//Motorola68000
    #defineEM_88K5//Motorola88000
    #defineEM_8607//Intel80860
    #defineEM_MIPS8//MIPSRS3000
    /*EndElfMachinesTypes*/

    /*ElfVersion*/
    #defineEV_NONE0//Invalidversion
    #defineEV_CURRENT1//Currentversion
    /*EndElfVersion*/

    /*ElfProgramHeaderTypes*/
    #definePT_NULL0
    #definePT_LOAD1
    #definePT_DYNAMIC2
    #definePT_INTERP3
    #definePT_NOTE4
    #definePT_SHLIB5
    #definePT_PHDR6
    #definePT_LOOS0x60000000
    #definePT_HIOS0x6fffffff
    #definePT_LOPROC0x70000000
    #definePT_HIPROC0x7fffffff
    #definePT_GNU_EH_FRAME0x6474e550
    #definePT_GNU_STACK(PT_LOOS+0x474e551)
    #definePT_GNU_RELRO(PT_LOOS+0x474e552)
    #definePT_PAX_FLAGS(PT_LOOS+0x5041580)

    /*EndElfProgramHeaderTypes*/

    typedefstruct{
    uInt8eIdent[16];/*Fileidentification.*/
    uInt16eType;/*Filetype.*/
    uInt16eMachine;/*Machinearchitecture.*/
    uInt32eVersion;/*ELFformatversion.*/
    uInt32eEntry;/*Entrypoint.*/
    uInt32ePhoff;/*Programheaderfileoffset.*/
    uInt32eShoff;/*Sectionheaderfileoffset.*/
    uInt32eFlags;/*Architecture-specificflags.*/
    uInt16eEhsize;/*SizeofELFheaderinbytes.*/
    uInt16ePhentsize;/*Sizeofprogramheaderentry.*/
    uInt16ePhnum;/*Numberofprogramheaderentries.*/
    uInt16eShentsize;/*Sizeofsectionheaderentry.*/
    uInt16eShnum;/*Numberofsectionheaderentries.*/
    uInt16eShstrndx;/*Sectionnamestringssection.*/
    }elfHeader;

    typedefstruct{
    uInt32phType;/*Entrytype.*/
    uInt32phOffset;/*Fileoffsetofcontents.*/
    uInt32phVaddr;/*Virtualaddressinmemoryimage.*/
    uInt32phPaddr;/*Physicaladdress(notused).*/
    uInt32phFilesz;/*Sizeofcontentsinfile.*/
    uInt32phMemsz;/*Sizeofcontentsinmemory.*/
    uInt32phFlags;/*Accesspermissionflags.*/
    uInt32phAlign;/*Alignmentinmemoryandfile.*/
    }elfProgramHeader;

    typedefstruct{
    uInt32shName;/*Sectionname(indexintothesectionheaderstringtable).*/
    uInt32shType;/*Sectiontype.*/
    uInt32shFlags;/*Sectionflags.*/
    uInt32shAddr;/*Addressinmemoryimage.*/
    uInt32shOffset;/*Offsetinfile.*/
    uInt32shSize;/*Sizeinbytes.*/
    uInt32shLink;/*Indexofarelatedsection.*/
    uInt32shInfo;/*Dependsonsectiontype.*/
    uInt32shAddralign;/*Alignmentinbytes.*/
    uInt32shEntsize;/*Sizeofeachentryinsection.*/
    }elfSectionHeader;

    typedefstruct{
    uInt32pltOffset;
    uInt32pltInfo;
    }elfPltInfo;

    typedefstruct{
    uInt32dynName;
    uInt32dynValue;
    uInt32dynSize;
    uInt32dynInfo;
    }elfDynSym;

    typedefstruct{
    uInt32dynVal;
    uInt32dynPtr;
    }elfDynamic;

    typedefstruct{
    int32_texecfd;
    uint32_tphdr;
    uint32_tphent;
    uint32_tphnum;
    uint32_tpagesz;
    uint32_tbase;
    uint32_tflags;
    uint32_tentry;
    uint32_ttrace;
    }Elf_Auxargs;

    char*elfGetShType(int);
    char*elfGetPhType(int);
    char*elfGetRelType(int);
    intelf_loadfile(kTask_t*p,constchar*file,uint32_t*addr,uint32_t*entry);

    #defineELF32_R_SYM(i)((i)>>8)
    #defineELF32_R_TYPE(i)((unsignedchar)(i))
    #defineELF32_R_INFO(s,t)((s)<<8+(unsignedchar)(t))

    #endif

    /***
    $Log: elf_8h.xml,v $
    Revision 1.6  2006/12/19 14:12:51  reddawg
    rtld-elf almost workign

    Revision1.22006/12/1515:43:46reddawg
    Changes

    Revision1.1.1.12006/06/0112:46:13reddawg
    ubix2

    Revision1.22005/10/1200:13:37reddawg
    Removed

    Revision1.1.1.12005/09/2617:23:54reddawg
    nomessage

    Revision1.72004/09/1101:20:08apwillia
    Cleanup'UnhandledHeader'printfswhencompiledinlinux

    Revision1.62004/06/1614:04:51reddawg
    Renamedatypedef

    Revision1.52004/06/1412:20:54reddawg
    notes:manybugsrepairedandldworks100%now.

    Revision1.42004/06/1201:27:26reddawg
    sharedobjects:yeswealmostfullysupportsharedobjects

    Revision1.32004/05/2115:20:00reddawg
    Cleanedup

    END
    ***/