Added wrapped libtbbmalloc

This commit is contained in:
ptitSeb 2021-10-30 22:50:37 +02:00
parent 3c0ac75fc7
commit cb9698a5b0
10 changed files with 81 additions and 0 deletions

View File

@ -405,6 +405,7 @@ set(WRAPPEDS
"${BOX86_ROOT}/src/wrapped/wrappedplc4.c"
"${BOX86_ROOT}/src/wrapped/wrappedssl3.c"
"${BOX86_ROOT}/src/wrapped/wrappedsecret1.c"
"${BOX86_ROOT}/src/wrapped/wrappedtbbmalloc.c"
)
if(ANDROID)
list(APPEND WRAPPEDS

View File

@ -145,6 +145,7 @@ GO("libplds4.so", plds4)
GO("libplc4.so", plc4)
GO("libssl3.so", ssl3)
GO("libsecret-1.so.0", secret1)
GO("libtbbmalloc.so.2", tbbmalloc)
#ifdef ANDROID
GO("libc.so", libc)

View File

@ -149,6 +149,7 @@
#() iFiI
#() iFiu
#() iFiU
#() iFil
#() iFip
#() iFIi
#() iFui
@ -397,6 +398,7 @@
#() iFpll
#() iFplp
#() iFpLi
#() iFpLL
#() iFpLp
#() iFppi
#() iFppI
@ -3969,6 +3971,7 @@ wrappedssl3:
- iFppp:
- SSL_AuthCertificateHook
- SSL_BadCertHook
wrappedtbbmalloc:
wrappedtcmallocminimal:
- iFpL:
- munmap

View File

@ -0,0 +1,8 @@
/*******************************************************************
* File automatically generated by rebuild_wrappers.py (v2.0.0.10) *
*******************************************************************/
#ifndef __wrappedtbbmallocDEFS_H_
#define __wrappedtbbmallocDEFS_H_
#endif // __wrappedtbbmallocDEFS_H_

View File

@ -0,0 +1,17 @@
/*******************************************************************
* File automatically generated by rebuild_wrappers.py (v2.0.0.10) *
*******************************************************************/
#ifndef __wrappedtbbmallocTYPES_H_
#define __wrappedtbbmallocTYPES_H_
#ifndef LIBNAME
#error You should only #include this file inside a wrapped*.c file
#endif
#ifndef ADDED_FUNCTIONS
#define ADDED_FUNCTIONS()
#endif
#define SUPER() ADDED_FUNCTIONS()
#endif // __wrappedtbbmallocTYPES_H_

View File

@ -0,0 +1,8 @@
/*******************************************************************
* File automatically generated by rebuild_wrappers.py (v2.0.0.10) *
*******************************************************************/
#ifndef __wrappedtbbmallocUNDEFS_H_
#define __wrappedtbbmallocUNDEFS_H_
#endif // __wrappedtbbmallocUNDEFS_H_

View File

@ -221,6 +221,7 @@ typedef int32_t (*iFii_t)(int32_t, int32_t);
typedef int32_t (*iFiI_t)(int32_t, int64_t);
typedef int32_t (*iFiu_t)(int32_t, uint32_t);
typedef int32_t (*iFiU_t)(int32_t, uint64_t);
typedef int32_t (*iFil_t)(int32_t, intptr_t);
typedef int32_t (*iFip_t)(int32_t, void*);
typedef int32_t (*iFIi_t)(int64_t, int32_t);
typedef int32_t (*iFui_t)(uint32_t, int32_t);
@ -469,6 +470,7 @@ typedef int32_t (*iFpli_t)(void*, intptr_t, int32_t);
typedef int32_t (*iFpll_t)(void*, intptr_t, intptr_t);
typedef int32_t (*iFplp_t)(void*, intptr_t, void*);
typedef int32_t (*iFpLi_t)(void*, uintptr_t, int32_t);
typedef int32_t (*iFpLL_t)(void*, uintptr_t, uintptr_t);
typedef int32_t (*iFpLp_t)(void*, uintptr_t, void*);
typedef int32_t (*iFppi_t)(void*, void*, int32_t);
typedef int32_t (*iFppI_t)(void*, void*, int64_t);
@ -2267,6 +2269,7 @@ void iFii(x86emu_t *emu, uintptr_t fcn) { iFii_t fn = (iFii_t)fcn; R_EAX=fn(*(in
void iFiI(x86emu_t *emu, uintptr_t fcn) { iFiI_t fn = (iFiI_t)fcn; R_EAX=fn(*(int32_t*)(R_ESP + 4), *(int64_t*)(R_ESP + 8)); }
void iFiu(x86emu_t *emu, uintptr_t fcn) { iFiu_t fn = (iFiu_t)fcn; R_EAX=fn(*(int32_t*)(R_ESP + 4), *(uint32_t*)(R_ESP + 8)); }
void iFiU(x86emu_t *emu, uintptr_t fcn) { iFiU_t fn = (iFiU_t)fcn; R_EAX=fn(*(int32_t*)(R_ESP + 4), *(uint64_t*)(R_ESP + 8)); }
void iFil(x86emu_t *emu, uintptr_t fcn) { iFil_t fn = (iFil_t)fcn; R_EAX=fn(*(int32_t*)(R_ESP + 4), *(intptr_t*)(R_ESP + 8)); }
void iFip(x86emu_t *emu, uintptr_t fcn) { iFip_t fn = (iFip_t)fcn; R_EAX=fn(*(int32_t*)(R_ESP + 4), *(void**)(R_ESP + 8)); }
void iFIi(x86emu_t *emu, uintptr_t fcn) { iFIi_t fn = (iFIi_t)fcn; R_EAX=fn(*(int64_t*)(R_ESP + 4), *(int32_t*)(R_ESP + 12)); }
void iFui(x86emu_t *emu, uintptr_t fcn) { iFui_t fn = (iFui_t)fcn; R_EAX=fn(*(uint32_t*)(R_ESP + 4), *(int32_t*)(R_ESP + 8)); }
@ -2515,6 +2518,7 @@ void iFpli(x86emu_t *emu, uintptr_t fcn) { iFpli_t fn = (iFpli_t)fcn; R_EAX=fn(*
void iFpll(x86emu_t *emu, uintptr_t fcn) { iFpll_t fn = (iFpll_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(intptr_t*)(R_ESP + 8), *(intptr_t*)(R_ESP + 12)); }
void iFplp(x86emu_t *emu, uintptr_t fcn) { iFplp_t fn = (iFplp_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(intptr_t*)(R_ESP + 8), *(void**)(R_ESP + 12)); }
void iFpLi(x86emu_t *emu, uintptr_t fcn) { iFpLi_t fn = (iFpLi_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(uintptr_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12)); }
void iFpLL(x86emu_t *emu, uintptr_t fcn) { iFpLL_t fn = (iFpLL_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(uintptr_t*)(R_ESP + 8), *(uintptr_t*)(R_ESP + 12)); }
void iFpLp(x86emu_t *emu, uintptr_t fcn) { iFpLp_t fn = (iFpLp_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(uintptr_t*)(R_ESP + 8), *(void**)(R_ESP + 12)); }
void iFppi(x86emu_t *emu, uintptr_t fcn) { iFppi_t fn = (iFppi_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(int32_t*)(R_ESP + 12)); }
void iFppI(x86emu_t *emu, uintptr_t fcn) { iFppI_t fn = (iFppI_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(int64_t*)(R_ESP + 12)); }

View File

@ -181,6 +181,7 @@ void iFii(x86emu_t *emu, uintptr_t fnc);
void iFiI(x86emu_t *emu, uintptr_t fnc);
void iFiu(x86emu_t *emu, uintptr_t fnc);
void iFiU(x86emu_t *emu, uintptr_t fnc);
void iFil(x86emu_t *emu, uintptr_t fnc);
void iFip(x86emu_t *emu, uintptr_t fnc);
void iFIi(x86emu_t *emu, uintptr_t fnc);
void iFui(x86emu_t *emu, uintptr_t fnc);
@ -429,6 +430,7 @@ void iFpli(x86emu_t *emu, uintptr_t fnc);
void iFpll(x86emu_t *emu, uintptr_t fnc);
void iFplp(x86emu_t *emu, uintptr_t fnc);
void iFpLi(x86emu_t *emu, uintptr_t fnc);
void iFpLL(x86emu_t *emu, uintptr_t fnc);
void iFpLp(x86emu_t *emu, uintptr_t fnc);
void iFppi(x86emu_t *emu, uintptr_t fnc);
void iFppI(x86emu_t *emu, uintptr_t fnc);

22
src/wrapped/wrappedtbbmalloc.c Executable file
View File

@ -0,0 +1,22 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <dlfcn.h>
#include "wrappedlibs.h"
#include "debug.h"
#include "wrapper.h"
#include "bridge.h"
#include "librarian/library_private.h"
#include "x86emu.h"
#include "callback.h"
static library_t* my_lib = NULL;
const char* tbbmallocName = "libtbbmalloc.so.2";
#define LIBNAME tbbmalloc
#include "wrappedlib_init.h"

View File

@ -0,0 +1,15 @@
#if !(defined(GO) && defined(GOM) && defined(GO2) && defined(DATA))
#error meh!
#endif
GO(scalable_aligned_free, vFp)
GO(scalable_aligned_malloc, pFLL)
GO(scalable_aligned_realloc, pFpLL)
GO(scalable_allocation_command, iFip)
GO(scalable_allocation_mode, iFil)
GO(scalable_calloc, pFLL)
GO(scalable_free, vFp)
GO(scalable_malloc, pFL)
GO(scalable_msize, LFp)
GO(scalable_posix_memalign, iFpLL)
GO(scalable_realloc, pFpL)