diff options
author | Luca Dariz <luca@orpolo.org> | 2023-02-16 22:33:16 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-02-16 23:27:25 +0100 |
commit | 78395241a0546832f0904492579df8210f7a176e (patch) | |
tree | 1f6d8454b4e347b9bf3d3b2b694a1d1526fa9413 /include | |
parent | bdfedb6e4ada9adc78137d75065b9e9607223f4f (diff) | |
download | gnumach-78395241a0546832f0904492579df8210f7a176e.tar.gz gnumach-78395241a0546832f0904492579df8210f7a176e.tar.bz2 gnumach-78395241a0546832f0904492579df8210f7a176e.zip |
x86_64: load Elf64 bootstrap modules if ! USER32
* i386/include/mach/i386/exec/elf.h: add Elf64 definitions and define
common Elf structures, corresponding to 32/64 bit variants at
compile time.
* include/mach/exec/elf.h: add Elf64 definitions
* kern/elf-load.c: use common Elf structures
Message-Id: <20230216213318.2048699-2-luca@orpolo.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/mach/exec/elf.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/include/mach/exec/elf.h b/include/mach/exec/elf.h index 81989309..3b545104 100644 --- a/include/mach/exec/elf.h +++ b/include/mach/exec/elf.h @@ -48,6 +48,22 @@ typedef struct { Elf32_Half e_shstrndx; } Elf32_Ehdr; +typedef struct { + unsigned char e_ident[EI_NIDENT]; /* Id bytes */ + Elf64_Quarter e_type; /* file type */ + Elf64_Quarter e_machine; /* machine type */ + Elf64_Half e_version; /* version number */ + Elf64_Addr e_entry; /* entry point */ + Elf64_Off e_phoff; /* Program hdr offset */ + Elf64_Off e_shoff; /* Section hdr offset */ + Elf64_Half e_flags; /* Processor flags */ + Elf64_Quarter e_ehsize; /* sizeof ehdr */ + Elf64_Quarter e_phentsize; /* Program header entry size */ + Elf64_Quarter e_phnum; /* Number of program headers */ + Elf64_Quarter e_shentsize; /* Section header entry size */ + Elf64_Quarter e_shnum; /* Number of section headers */ + Elf64_Quarter e_shstrndx; /* String table index */ +} Elf64_Ehdr; /* e_ident[] identification indexes - figure 4-4, page 4-7 */ @@ -104,6 +120,7 @@ typedef struct { #define EM_SPARC64 11 #define EM_PARISC 15 #define EM_PPC 20 +#define EM_X86_64 62 /* version - page 4-6 */ @@ -233,6 +250,17 @@ typedef struct { Elf32_Word p_align; } Elf32_Phdr; +typedef struct { + Elf64_Half p_type; /* entry type */ + Elf64_Half p_flags; /* flags */ + Elf64_Off p_offset; /* offset */ + Elf64_Addr p_vaddr; /* virtual address */ + Elf64_Addr p_paddr; /* physical address */ + Elf64_Xword p_filesz; /* file size */ + Elf64_Xword p_memsz; /* memory size */ + Elf64_Xword p_align; /* memory & file alignment */ +} Elf64_Phdr; + /* segment types - page 5-3, figure 5-2 */ #define PT_NULL 0 @@ -291,6 +319,14 @@ typedef struct { #define DT_TEXTREL 22 #define DT_JMPREL 23 +#if defined(__x86_64__) && ! defined(USER32) +typedef Elf64_Ehdr Elf_Ehdr; +typedef Elf64_Phdr Elf_Phdr; +#else +typedef Elf32_Ehdr Elf_Ehdr; +typedef Elf32_Phdr Elf_Phdr; +#endif + /* * Bootstrap doesn't need machine dependent extensions. */ |