diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2021-03-03 16:43:42 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2021-03-03 16:43:42 +0100 |
| commit | f4829a8ce42b1abbcc8621802d6c6fad3a56cd5d (patch) | |
| tree | 211276c3587721126ded00be46487bf23b605591 /src/include/elfloader.h | |
| parent | f73fbd3cee38b4c0086c934d73972375c9c8c7d6 (diff) | |
| download | box64-f4829a8ce42b1abbcc8621802d6c6fad3a56cd5d.tar.gz box64-f4829a8ce42b1abbcc8621802d6c6fad3a56cd5d.zip | |
More infrastructure added to elf and x64 emu
Diffstat (limited to 'src/include/elfloader.h')
| -rwxr-xr-x | src/include/elfloader.h | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/src/include/elfloader.h b/src/include/elfloader.h index 28ce4844..a4d2cb6b 100755 --- a/src/include/elfloader.h +++ b/src/include/elfloader.h @@ -3,20 +3,20 @@ #include <stdio.h> typedef struct elfheader_s elfheader_t; -//typedef struct lib_s lib_t; -//typedef struct library_s library_t; -//typedef struct kh_mapsymbols_s kh_mapsymbols_t; +typedef struct lib_s lib_t; +typedef struct library_s library_t; +typedef struct kh_mapsymbols_s kh_mapsymbols_t; typedef struct box64context_s box64context_t; -//typedef struct x86emu_s x86emu_t; -//typedef struct needed_libs_s needed_libs_t; -//#ifdef DYNAREC -//typedef struct dynablocklist_s dynablocklist_t; -//#endif +typedef struct x64emu_s x64emu_t; +typedef struct needed_libs_s needed_libs_t; +#ifdef DYNAREC +typedef struct dynablocklist_s dynablocklist_t; +#endif elfheader_t* LoadAndCheckElfHeader(FILE* f, const char* name, int exec); // exec : 0 = lib, 1 = exec void FreeElfHeader(elfheader_t** head); const char* ElfName(elfheader_t* head); -//void ElfAttachLib(elfheader_t* head, library_t* lib); +void ElfAttachLib(elfheader_t* head, library_t* lib); // return 0 if OK int CalcLoadAddr(elfheader_t* head); @@ -24,34 +24,34 @@ int AllocElfMemory(box64context_t* context, elfheader_t* head, int mainbin); void FreeElfMemory(elfheader_t* head); int LoadElfMemory(FILE* f, box64context_t* context, elfheader_t* head); int ReloadElfMemory(FILE* f, box64context_t* context, elfheader_t* head); -//int RelocateElf(lib_t *maplib, lib_t* local_maplib, elfheader_t* head); -//int RelocateElfPlt(lib_t *maplib, lib_t* local_maplib, elfheader_t* head); +int RelocateElf(lib_t *maplib, lib_t* local_maplib, elfheader_t* head); +int RelocateElfPlt(lib_t *maplib, lib_t* local_maplib, elfheader_t* head); void CalcStack(elfheader_t* h, uint32_t* stacksz, int* stackalign); -//uintptr_t GetEntryPoint(lib_t* maplib, elfheader_t* h); +uintptr_t GetEntryPoint(lib_t* maplib, elfheader_t* h); uintptr_t GetLastByte(elfheader_t* h); -//void AddSymbols(lib_t *maplib, kh_mapsymbols_t* mapsymbols, kh_mapsymbols_t* weaksymbols, kh_mapsymbols_t* localsymbols, elfheader_t* h); -//int LoadNeededLibs(elfheader_t* h, lib_t *maplib, needed_libs_t* neededlibs, int local, box64context_t *box86, x86emu_t* emu); -//uintptr_t GetElfInit(elfheader_t* h); -//uintptr_t GetElfFini(elfheader_t* h); -//void RunElfInit(elfheader_t* h, x86emu_t *emu); -//void RunElfFini(elfheader_t* h, x86emu_t *emu); -//void RunDeferedElfInit(x86emu_t *emu); -//void* GetBaseAddress(elfheader_t* h); -//void* GetElfDelta(elfheader_t* h); -//uint32_t GetBaseSize(elfheader_t* h); -//int IsAddressInElfSpace(elfheader_t* h, uintptr_t addr); -//elfheader_t* FindElfAddress(box64context_t *context, uintptr_t addr); -//const char* FindNearestSymbolName(elfheader_t* h, void* p, uintptr_t* start, uint32_t* sz); -//int32_t GetTLSBase(elfheader_t* h); -//uint32_t GetTLSSize(elfheader_t* h); -//void* GetTLSPointer(box64context_t* context, elfheader_t* h); -//void* GetDTatOffset(box64context_t* context, int index, int offset); -//#ifdef DYNAREC -//dynablocklist_t* GetDynablocksFromAddress(box64context_t *context, uintptr_t addr); -//dynablocklist_t* GetDynablocksFromElf(elfheader_t* h); -//#endif -//void ResetSpecialCaseMainElf(elfheader_t* h); -//void CreateMemorymapFile(box64context_t* context, int fd); +void AddSymbols(lib_t *maplib, kh_mapsymbols_t* mapsymbols, kh_mapsymbols_t* weaksymbols, kh_mapsymbols_t* localsymbols, elfheader_t* h); +int LoadNeededLibs(elfheader_t* h, lib_t *maplib, needed_libs_t* neededlibs, int local, box64context_t *box86, x64emu_t* emu); +uintptr_t GetElfInit(elfheader_t* h); +uintptr_t GetElfFini(elfheader_t* h); +void RunElfInit(elfheader_t* h, x64emu_t *emu); +void RunElfFini(elfheader_t* h, x64emu_t *emu); +void RunDeferedElfInit(x64emu_t *emu); +void* GetBaseAddress(elfheader_t* h); +void* GetElfDelta(elfheader_t* h); +uint32_t GetBaseSize(elfheader_t* h); +int IsAddressInElfSpace(elfheader_t* h, uintptr_t addr); +elfheader_t* FindElfAddress(box64context_t *context, uintptr_t addr); +const char* FindNearestSymbolName(elfheader_t* h, void* p, uintptr_t* start, uint32_t* sz); +int32_t GetTLSBase(elfheader_t* h); +uint32_t GetTLSSize(elfheader_t* h); +void* GetTLSPointer(box64context_t* context, elfheader_t* h); +void* GetDTatOffset(box64context_t* context, int index, int offset); +#ifdef DYNAREC +dynablocklist_t* GetDynablocksFromAddress(box64context_t *context, uintptr_t addr); +dynablocklist_t* GetDynablocksFromElf(elfheader_t* h); +#endif +void ResetSpecialCaseMainElf(elfheader_t* h); +void CreateMemorymapFile(box64context_t* context, int fd); int ElfCheckIfUseTCMallocMinimal(elfheader_t* h); // return 1 if tcmalloc is used |