about summary refs log tree commit diff stats
path: root/src/include/librarian.h
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2021-03-03 16:43:42 +0100
committerptitSeb <sebastien.chev@gmail.com>2021-03-03 16:43:42 +0100
commitf4829a8ce42b1abbcc8621802d6c6fad3a56cd5d (patch)
tree211276c3587721126ded00be46487bf23b605591 /src/include/librarian.h
parentf73fbd3cee38b4c0086c934d73972375c9c8c7d6 (diff)
downloadbox64-f4829a8ce42b1abbcc8621802d6c6fad3a56cd5d.tar.gz
box64-f4829a8ce42b1abbcc8621802d6c6fad3a56cd5d.zip
More infrastructure added to elf and x64 emu
Diffstat (limited to 'src/include/librarian.h')
-rwxr-xr-xsrc/include/librarian.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/include/librarian.h b/src/include/librarian.h
new file mode 100755
index 00000000..a25fcd7b
--- /dev/null
+++ b/src/include/librarian.h
@@ -0,0 +1,51 @@
+#ifndef __LIBRARIAN_H_
+#define __LIBRARIAN_H_
+#include <stdint.h>
+
+typedef struct lib_s lib_t;
+typedef struct bridge_s bridge_t;
+typedef struct library_s library_t;
+typedef struct kh_mapsymbols_s kh_mapsymbols_t;
+typedef struct dlprivate_s dlprivate_t;
+typedef struct box64context_s  box64context_t;
+typedef struct x64emu_s x64emu_t;
+typedef struct elfheader_s elfheader_t;
+typedef struct needed_libs_s needed_libs_t;
+typedef struct kh_mapoffsets_s kh_mapoffsets_t;
+typedef char* cstr_t;
+
+lib_t *NewLibrarian(box64context_t* context, int ownlibs);
+void FreeLibrarian(lib_t **maplib);
+dlprivate_t *NewDLPrivate();
+void FreeDLPrivate(dlprivate_t **lib);
+
+box64context_t* GetLibrarianContext(lib_t* maplib);
+kh_mapsymbols_t* GetMapSymbol(lib_t* maplib);
+kh_mapsymbols_t* GetWeakSymbol(lib_t* maplib);
+kh_mapsymbols_t* GetLocalSymbol(lib_t* maplib);
+kh_mapsymbols_t* GetGlobalData(lib_t* maplib);
+int AddNeededLib(lib_t* maplib, needed_libs_t* neededlibs, int local, const char* path, box64context_t* box86, x64emu_t* emu); // 0=success, 1=error
+library_t* GetLibMapLib(lib_t* maplib, const char* name);
+library_t* GetLibInternal(const char* name);
+uintptr_t FindGlobalSymbol(lib_t *maplib, const char* name);
+int GetNoSelfSymbolStartEnd(lib_t *maplib, const char* name, uintptr_t* start, uintptr_t* end, elfheader_t* self);
+int GetSelfSymbolStartEnd(lib_t *maplib, const char* name, uintptr_t* start, uintptr_t* end, elfheader_t *self);
+int GetGlobalSymbolStartEnd(lib_t *maplib, const char* name, uintptr_t* start, uintptr_t* end);
+int GetGlobalNoWeakSymbolStartEnd(lib_t *maplib, const char* name, uintptr_t* start, uintptr_t* end);
+int GetLocalSymbolStartEnd(lib_t *maplib, const char* name, uintptr_t* start, uintptr_t* end, elfheader_t *self);
+int GetNoWeakSymbolStartEnd(lib_t *maplib, const char* name, uintptr_t* start, uintptr_t* end, elfheader_t *self);
+elfheader_t* GetGlobalSymbolElf(lib_t *maplib, const char* name);
+int IsGlobalNoWeakSymbolInNative(lib_t *maplib, const char* name);
+
+void AddSymbol(kh_mapsymbols_t *mapsymbols, const char* name, uintptr_t addr, uint32_t sz); // replace if already there
+uintptr_t FindSymbol(kh_mapsymbols_t *mapsymbols, const char* name);
+void AddWeakSymbol(kh_mapsymbols_t *mapsymbols, const char* name, uintptr_t addr, uint32_t sz); // don't add if already there
+int GetSymbolStartEnd(kh_mapsymbols_t* mapsymbols, const char* name, uintptr_t* start, uintptr_t* end);
+const char* GetSymbolName(kh_mapsymbols_t* mapsymbols, void* p, uintptr_t* offs, uint32_t* sz);
+
+const char* FindSymbolName(lib_t *maplib, void* p, void** start, uint32_t* sz, const char** libname, void** base);
+
+void AddOffsetSymbol(lib_t *maplib, void* offs, const char* name);
+const char* GetNameOffset(lib_t *maplib, void* offs);
+
+#endif //__LIBRARIAN_H_
\ No newline at end of file