diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2021-03-13 16:40:44 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2021-03-13 16:40:44 +0100 |
| commit | 0823bfaed2977a38aa4cfc582d09a071a7a21b67 (patch) | |
| tree | febd569e9ba7e6fb31ca7bcd962ead12a64f45f0 /src/include | |
| parent | 3bcb72a083a8a9d7c03dc5cd003af8ad90ab7d03 (diff) | |
| download | box64-0823bfaed2977a38aa4cfc582d09a071a7a21b67.tar.gz box64-0823bfaed2977a38aa4cfc582d09a071a7a21b67.zip | |
Added custom memory handling
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/custommem.h | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/include/custommem.h b/src/include/custommem.h index d6bca59c..a018fd37 100644 --- a/src/include/custommem.h +++ b/src/include/custommem.h @@ -6,31 +6,31 @@ 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); +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 +#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); +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 @@ -38,11 +38,11 @@ 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(); +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 |