fix(kernel/elf): interpreter loading is now correctly implemented

ref: linux @ fs/binfmt_elf.c
Signed-off-by: EnderIce2 <enderice2@protonmail.com>
This commit is contained in:
EnderIce2 2025-04-03 06:15:12 +00:00
parent 91ad0e14df
commit c660a7fe4f
Signed by: enderice2
GPG Key ID: FEB6B8A8507BA62E
3 changed files with 315 additions and 628 deletions

File diff suppressed because it is too large Load Diff

View File

@ -689,6 +689,8 @@ enum SpecialSections
#define NT_MIPS_MSA 0x802
#define NT_VERSION 1
#define NT_GNU_PROPERTY_TYPE_0 5
typedef struct elf32_hdr
{
unsigned char e_ident[EI_NIDENT];
@ -968,6 +970,9 @@ typedef Elf64_Rel Elf_Rel;
typedef Elf64_Sym Elf_Sym;
typedef Elf64_Dyn Elf_Dyn;
typedef Elf64_Rela Elf_Rela;
typedef Elf64_Nhdr Elf_Nhdr;
typedef Elf64_Prstatus Elf_Prstatus;
typedef Elf64_Prpsinfo Elf_Prpsinfo;
#elif defined(__i386__) || defined(__arm__)
typedef Elf32_Addr Elf_Addr;
typedef Elf32_Half Elf_Half;
@ -982,6 +987,9 @@ typedef Elf32_Rel Elf_Rel;
typedef Elf32_Sym Elf_Sym;
typedef Elf32_Dyn Elf_Dyn;
typedef Elf32_Rela Elf_Rela;
typedef Elf32_Nhdr Elf_Nhdr;
typedef Elf32_Prstatus Elf_Prstatus;
typedef Elf32_Prpsinfo Elf_Prpsinfo;
#endif
#endif // !__FENNIX_KERNEL_ELF_H__

View File

@ -66,20 +66,15 @@ namespace Execute
Tasking::IP ip;
void *ELFProgramHeaders;
void GenerateAuxiliaryVector_x86_32(Memory::VirtualMemoryArea *vma,
FileNode *fd, Elf32_Ehdr ELFHeader,
uint32_t EntryPoint,
uint32_t BaseAddress);
void GenerateAuxiliaryVector(Memory::VirtualMemoryArea *vma,
FileNode *fd, Elf64_Ehdr ELFHeader,
uintptr_t EntryPoint,
uintptr_t BaseAddress);
void GenerateAuxiliaryVector_x86_64(Memory::VirtualMemoryArea *vma,
FileNode *fd, Elf64_Ehdr ELFHeader,
uint64_t EntryPoint,
uint64_t BaseAddress);
void LoadSegments(FileNode *fd, Tasking::PCB *TargetProcess, Elf_Ehdr &ELFHeader, uintptr_t &BaseAddress);
void LoadExec_x86_32(FileNode *fd, Tasking::PCB *TargetProcess);
void LoadExec_x86_64(FileNode *fd, Tasking::PCB *TargetProcess);
void LoadDyn_x86_32(FileNode *fd, Tasking::PCB *TargetProcess);
void LoadDyn_x86_64(FileNode *fd, Tasking::PCB *TargetProcess);
void LoadExec(FileNode *fd, Tasking::PCB *TargetProcess);
void LoadDyn(FileNode *fd, Tasking::PCB *TargetProcess);
bool LoadInterpreter(FileNode *fd, Tasking::PCB *TargetProcess);
public: