mirror of
https://github.com/decompals/wibo.git
synced 2025-12-11 22:43:58 +00:00
Refactor memory management into wibo::heap
- Removes blockUpper2GB hack; we now start early in the process and reserve all (available) space in the lower 2GB address space, leaving the upper 2GB untouched for host code - All virtual memory operations flow through wibo::heap for bookkeeping - All guest code uses a guest mimalloc area + thread-local heaps reserved in the guest address space
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "common.h"
|
||||
#include "context.h"
|
||||
#include "crt_trampolines.h"
|
||||
#include "heap.h"
|
||||
#include "kernel32/internal.h"
|
||||
#include "modules.h"
|
||||
|
||||
@@ -180,25 +181,25 @@ const char *CDECL strrchr(const char *str, int ch) {
|
||||
void *CDECL malloc(SIZE_T size) {
|
||||
HOST_CONTEXT_GUARD();
|
||||
VERBOSE_LOG("malloc(%zu)\n", size);
|
||||
return ::malloc(size);
|
||||
return wibo::heap::guestMalloc(size);
|
||||
}
|
||||
|
||||
void *CDECL calloc(SIZE_T count, SIZE_T size) {
|
||||
HOST_CONTEXT_GUARD();
|
||||
VERBOSE_LOG("calloc(%zu, %zu)\n", count, size);
|
||||
return ::calloc(count, size);
|
||||
return wibo::heap::guestCalloc(count, size);
|
||||
}
|
||||
|
||||
void *CDECL realloc(void *ptr, SIZE_T newSize) {
|
||||
HOST_CONTEXT_GUARD();
|
||||
VERBOSE_LOG("realloc(%p, %zu)\n", ptr, newSize);
|
||||
return ::realloc(ptr, newSize);
|
||||
return wibo::heap::guestRealloc(ptr, newSize);
|
||||
}
|
||||
|
||||
void CDECL free(void *ptr) {
|
||||
HOST_CONTEXT_GUARD();
|
||||
VERBOSE_LOG("free(%p)\n", ptr);
|
||||
::free(ptr);
|
||||
wibo::heap::guestFree(ptr);
|
||||
}
|
||||
|
||||
void *CDECL memcpy(void *dest, const void *src, SIZE_T count) {
|
||||
|
||||
Reference in New Issue
Block a user