From 311842a43aa34276dc41da6e2f3a63ac80d4849c Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Mon, 1 Mar 2021 15:52:05 +0100 Subject: Read elf header of launched executable --- src/include/custommem.h | 52 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 src/include/custommem.h (limited to 'src/include/custommem.h') diff --git a/src/include/custommem.h b/src/include/custommem.h new file mode 100644 index 00000000..d6bca59c --- /dev/null +++ b/src/include/custommem.h @@ -0,0 +1,52 @@ +#ifndef __CUSTOM_MEM__H_ +#define __CUSTOM_MEM__H_ +#include +#include + + +typedef struct box64context_s box64context_t; + +//void* customMalloc(size_t size); +//void* customCalloc(size_t n, size_t size); +//void* customRealloc(void* p, size_t size); +//void customFree(void* p); + +//#define kcalloc customCalloc +//#define kmalloc customMalloc +//#define krealloc customRealloc +//#define kfree customFree + +#ifdef DYNAREC +//typedef struct dynablock_s dynablock_t; +//typedef struct dynablocklist_s dynablocklist_t; +//// custom protection flag to mark Page that are Write protected for Dynarec purpose +//uintptr_t AllocDynarecMap(dynablock_t* db, int size); +//void FreeDynarecMap(dynablock_t* db, uintptr_t addr, uint32_t size); + +//void addDBFromAddressRange(uintptr_t addr, uintptr_t size); +//void cleanDBFromAddressRange(uintptr_t addr, uintptr_t size, int destroy); + +//dynablocklist_t* getDB(uintptr_t idx); +//void addJumpTableIfDefault(void* addr, void* jmp); +//void setJumpTableDefault(void* addr); +//uintptr_t getJumpTable(); +//uintptr_t getJumpTableAddress(uintptr_t addr); +#endif + +#define PROT_DYNAREC 0x80 +void updateProtection(uintptr_t addr, uintptr_t size, uint32_t prot); +void setProtection(uintptr_t addr, uintptr_t size, uint32_t prot); +uint32_t getProtection(uintptr_t addr); +#ifdef DYNAREC +//void protectDB(uintptr_t addr, uintptr_t size); +//void protectDBnolock(uintptr_t addr, uintptr_t size); +//void unprotectDB(uintptr_t addr, uintptr_t size); +//void lockDB(); +//void unlockDB(); +#endif + + +void init_custommem_helper(box64context_t* ctx); +void fini_custommem_helper(box64context_t* ctx); + +#endif //__CUSTOM_MEM__H_ \ No newline at end of file -- cgit 1.4.1