2 meinOS - A unix-like x86 microkernel operating system
3 Copyright (C) 2008 Janosch Gräf <janosch.graef@gmx.net>
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include <sys/types.h>
31 #define ET_LOPROC 0xff00
32 #define ET_HIPROC 0xffff
59 #define ELFCLASSNONE 0
66 // Programm Header Type
67 #define PT_NULL 0x00000000
68 #define PT_LOAD 0x00000001
69 #define PT_DYNAMIC 0x00000002
70 #define PT_INTERP 0x00000003
71 #define PT_NOTE 0x00000004
72 #define PT_SHLIB 0x00000005
73 #define PT_PHDR 0x00000006
74 #define PT_LOPROC 0x70000000
75 #define PT_HIPROC 0x7fffffff
77 #define PT_LOOS 0x60000000
78 #define PT_HIOS 0x6fffffff
79 #define PT_GNU_EH_FRAME 0x6474e550
80 #define PT_GNU_STACK (PT_LOOS+0x474e551)
82 // Programm Header Flag
88 uint8_t ident
[EI_NIDENT
];
102 } __attribute__ ((packed
)) elf_header_t
;
113 } __attribute__ ((packed
)) elf_progheader_t
;
115 int elf_validate(elf_header_t
*header
);
116 int elf_loadseg(void *memaddr
,size_t memsize
,void *fileaddr
,size_t filesize
,addrspace_t
*addrspace
,int writable
);
117 void *elf_load(addrspace_t
*addrspace
,void *file
,size_t filesize
);