diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-10-13 11:20:25 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-10-13 11:20:25 +0200 |
| commit | d31b9c9caa6b28e5c9246dcffc88367ef9d4e8f6 (patch) | |
| tree | 6bd6fcabb367ee7979ddf1fa0422f0609c81d10a /src/include/debug.h | |
| parent | 2670d37542ddb7b03cc4e12b610f2b686562ee58 (diff) | |
| download | box64-d31b9c9caa6b28e5c9246dcffc88367ef9d4e8f6.tar.gz box64-d31b9c9caa6b28e5c9246dcffc88367ef9d4e8f6.zip | |
[BOX32] Allow internal memory to be in 32bits space if needed
Diffstat (limited to 'src/include/debug.h')
| -rw-r--r-- | src/include/debug.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/include/debug.h b/src/include/debug.h index a17e76a4..9fb183b4 100644 --- a/src/include/debug.h +++ b/src/include/debug.h @@ -177,4 +177,30 @@ extern char* box_strdup(const char* s); extern char* box_realpath(const char* path, char* ret); #endif +//use actual_XXXX for internal memory that should be in 32bits space when box32 is active +//use box_XXX for internal memory that doesn't need anything special +#ifdef BOX32 +int isCustomAddr(void* p); +void* box32_calloc(size_t n, size_t s); +void* box32_malloc(size_t s); +void* box32_realloc(void* p, size_t s); +void box32_free(void* p); +void* box32_memalign(size_t align, size_t s); +size_t box32_malloc_usable_size(void* p); + +#define actual_calloc(A, B) (box64_is32bits?box32_calloc(A, B):box_calloc(A, B)) +#define actual_malloc(A) (box64_is32bits?box32_malloc(A):box_malloc(A)) +#define actual_realloc(A, B) (box64_is32bits?box32_realloc(A, B):box_realloc(A, B)) +#define actual_free(A) (box64_is32bits?box32_free(A):box_free(A)) +#define actual_memalign(A, B) (box64_is32bits?box32_memalign(A, B):box_memalign(A, B)) +#define actual_malloc_usable_size(A) (box64_is32bits?box32_malloc_usable_size(A):box_malloc_usable_size(A)) +#else +#define actual_calloc(A, B) box_calloc(A, B) +#define actual_malloc(A) box_malloc(A) +#define actual_realloc(A, B) box_realloc(A, B) +#define actual_free(A) box_free(A) +#define actual_memalign(A, B) box_memalign(A, B) +#define actual_malloc_usable_size(A) box_malloc_usable_size(A) +#endif + #endif //__DEBUG_H_ |