UbixOS V2
2.0
elf.h
Go to the documentation of this file.
1
/*-
2
* Copyright (c) 2002-2018 The UbixOS Project.
3
* All rights reserved.
4
*
5
* This was developed by Christopher W. Olsen for the UbixOS Project.
6
*
7
* Redistribution and use in source and binary forms, with or without modification, are permitted
8
* provided that the following conditions are met:
9
*
10
* 1) Redistributions of source code must retain the above copyright notice, this list of
11
* conditions, the following disclaimer and the list of authors.
12
* 2) Redistributions in binary form must reproduce the above copyright notice, this list of
13
* conditions, the following disclaimer and the list of authors in the documentation and/or
14
* other materials provided with the distribution.
15
* 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to
16
* endorse or promote products derived from this software without specific prior written
17
* permission.
18
*
19
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
20
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
22
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
24
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
*/
28
29
#ifndef _SYS_ELF_H_
30
#define _SYS_ELF_H_ 1
31
32
#define __i386__ 1
33
34
#include <
sys/types.h
>
35
#include <
i386/elf.h
>
36
#include <
sys/elf32.h
>
37
#include <
sys/elf64.h
>
38
39
typedef
struct
elf_file
{
40
int
preloaded
;
/* Was file pre-loaded */
41
caddr_t
address
;
/* Relocation address */
42
Elf_Dyn *
dynamic
;
/* Symbol table etc. */
43
Elf_Hashelt
nbuckets
;
/* DT_HASH info */
44
Elf_Hashelt
nchains
;
45
const
Elf_Hashelt *
buckets
;
46
const
Elf_Hashelt *
chains
;
47
caddr_t
hash
;
48
caddr_t
strtab
;
/* DT_STRTAB */
49
int
strsz
;
/* DT_STRSZ */
50
const
Elf_Sym *
symtab
;
/* DT_SYMTAB */
51
Elf_Addr *
got
;
/* DT_PLTGOT */
52
const
Elf_Rel *
pltrel
;
/* DT_JMPREL */
53
int
pltrelsize
;
/* DT_PLTRELSZ */
54
const
Elf_Rela *
pltrela
;
/* DT_JMPREL */
55
int
pltrelasize
;
/* DT_PLTRELSZ */
56
const
Elf_Rel *
rel
;
/* DT_REL */
57
int
relsize
;
/* DT_RELSZ */
58
const
Elf_Rela *
rela
;
/* DT_RELA */
59
int
relasize
;
/* DT_RELASZ */
60
caddr_t
modptr
;
61
const
Elf_Sym *
ddbsymtab
;
/* The symbol table we are using */
62
long
ddbsymcnt
;
/* Number of symbols */
63
caddr_t
ddbstrtab
;
/* String table */
64
long
ddbstrcnt
;
/* number of bytes in string table */
65
caddr_t
symbase
;
/* malloc'ed symbold base */
66
caddr_t
strbase
;
/* malloc'ed string base */
67
caddr_t
ctftab
;
/* CTF table */
68
long
ctfcnt
;
/* number of bytes in CTF table */
69
caddr_t
ctfoff
;
/* CTF offset table */
70
caddr_t
typoff
;
/* Type offset table */
71
long
typlen
;
/* Number of type entries. */
72
Elf_Addr
pcpu_start
;
/* Pre-relocation pcpu set start. */
73
Elf_Addr
pcpu_stop
;
/* Pre-relocation pcpu set stop. */
74
Elf_Addr
pcpu_base
;
/* Relocated pcpu set address. */
75
} *
elf_file_t
;
76
77
78
#include <
ubixos/ubthread.h
>
79
80
#define elfExecutable 0x002
81
#define elfLibrary 0x003
82
83
char
*
elfGetShType
(
int
);
84
char
*
elfGetPhType
(
int
);
85
char
*
elfGetRelType
(
int
);
86
87
int
elf_load_file
(
kTask_t
*p,
const
char
*
file
,
uint32_t
*addr,
uint32_t
*entry );
88
89
#endif
/* END _SYS_ELF_H */
taskStruct
Definition:
sched.h:62
elf_file::ctfoff
caddr_t ctfoff
Definition:
elf.h:69
elf_file::strbase
caddr_t strbase
Definition:
elf.h:66
elf_file::preloaded
int preloaded
Definition:
elf.h:40
elfGetShType
char * elfGetShType(int)
Definition:
elf.c:159
elf_file::pltrelsize
int pltrelsize
Definition:
elf.h:53
elf_file
Definition:
elf.h:39
elf32.h
elf_file::pcpu_base
Elf_Addr pcpu_base
Definition:
elf.h:74
file
Definition:
descrip.h:67
elf_file::pltrelasize
int pltrelasize
Definition:
elf.h:55
elf_file::ddbstrcnt
long ddbstrcnt
Definition:
elf.h:64
elf_file::nchains
Elf_Hashelt nchains
Definition:
elf.h:44
elfGetPhType
char * elfGetPhType(int)
Definition:
elf.c:163
types.h
elf_file::ctfcnt
long ctfcnt
Definition:
elf.h:68
elf_file::typlen
long typlen
Definition:
elf.h:71
elf_file::got
Elf_Addr * got
Definition:
elf.h:51
elf_file::modptr
caddr_t modptr
Definition:
elf.h:60
elf_file::relasize
int relasize
Definition:
elf.h:59
elf_file::typoff
caddr_t typoff
Definition:
elf.h:70
elf_file::address
caddr_t address
Definition:
elf.h:41
elf_file::strtab
caddr_t strtab
Definition:
elf.h:48
ubthread.h
elf_file::dynamic
Elf_Dyn * dynamic
Definition:
elf.h:42
elf_file_t
struct elf_file * elf_file_t
uint32_t
__uint32_t uint32_t
Definition:
types.h:46
elf64.h
elfGetRelType
char * elfGetRelType(int)
Definition:
elf.c:167
elf_file::ddbsymcnt
long ddbsymcnt
Definition:
elf.h:62
elf_file::pcpu_start
Elf_Addr pcpu_start
Definition:
elf.h:72
elf_file::symbase
caddr_t symbase
Definition:
elf.h:65
elf_file::strsz
int strsz
Definition:
elf.h:49
caddr_t
char * caddr_t
Definition:
types.h:41
elf_file::ddbsymtab
const Elf_Sym * ddbsymtab
Definition:
elf.h:61
elf_file::pltrela
const Elf_Rela * pltrela
Definition:
elf.h:54
elf_file::ctftab
caddr_t ctftab
Definition:
elf.h:67
elf_file::symtab
const Elf_Sym * symtab
Definition:
elf.h:50
elf_load_file
int elf_load_file(kTask_t *p, const char *file, uint32_t *addr, uint32_t *entry)
Definition:
elf.c:37
elf_file::ddbstrtab
caddr_t ddbstrtab
Definition:
elf.h:63
elf_file::nbuckets
Elf_Hashelt nbuckets
Definition:
elf.h:43
elf_file::relsize
int relsize
Definition:
elf.h:57
elf.h
elf_file::chains
const Elf_Hashelt * chains
Definition:
elf.h:46
elf_file::pcpu_stop
Elf_Addr pcpu_stop
Definition:
elf.h:73
elf_file::pltrel
const Elf_Rel * pltrel
Definition:
elf.h:52
elf_file::rel
const Elf_Rel * rel
Definition:
elf.h:56
elf_file::buckets
const Elf_Hashelt * buckets
Definition:
elf.h:45
elf_file::rela
const Elf_Rela * rela
Definition:
elf.h:58
elf_file::hash
caddr_t hash
Definition:
elf.h:47
C:
Dev
git
UbixOS
sys
include
sys
elf.h
Generated by
1.8.16