Files
FEX-Emu--FEX/ThunkLibs/Generators/libfex_malloc.py
T
Ryan Houdek 29debcda3d Thunks: Adds FEX malloc libraries
These are required to expose FEX's allocators to the guest.
Which is required when we are compiled with jemalloc, otherwise
the libraries will crash on allocations.

This needs to be done in stages otherwise glibc will load the library
and as it is setting up symbols, replace malloc, which isn't set
currently and cause a crash
2021-10-02 18:12:07 -07:00

24 lines
604 B
Python

#!/usr/bin/python3
from ThunkHelpers import *
lib("libfex_malloc")
# FEX
fn("void fex_get_allocation_ptrs(AllocationPtrs *)")
no_ldr()
# Memory allocators
fn("void free(void*)"); no_unpack()
fn("void *calloc(size_t, size_t)"); no_unpack()
fn("void *memalign(size_t, size_t)"); no_unpack()
fn("void *realloc(void*, size_t)"); no_unpack()
fn("void *valloc(size_t)"); no_unpack()
fn("int posix_memalign(void**, size_t, size_t)"); no_unpack()
fn("void *aligned_alloc(size_t, size_t)"); no_unpack()
fn("size_t malloc_usable_size(void *)"); no_unpack()
fn("void *malloc(size_t)"); no_unpack()
Generate()