Added wrapped libatomic (backported from box64)

This commit is contained in:
ptitSeb 2023-12-09 10:43:16 +01:00
parent 14a53affc0
commit e35d6d22a4
10 changed files with 167 additions and 0 deletions

View File

@ -546,6 +546,7 @@ set(WRAPPEDS
"${BOX86_ROOT}/src/wrapped/wrappedfaudio.c"
"${BOX86_ROOT}/src/wrapped/wrappedtbbmallocproxy.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibfuse.c"
"${BOX86_ROOT}/src/wrapped/wrappedatomic.c"
)
if(ANDROID)
list(APPEND WRAPPEDS

View File

@ -176,6 +176,7 @@ GO("libpcap.so.0", pcap)
GO("libFAudio.so.0", faudio)
GO("libtbbmalloc_proxy.so.2", tbbmallocproxy)
GO("libfuse.so.2", libfuse)
GO("libatomic.so.1", atomic)
#ifdef ANDROID
GO("libc.so", libc)

View File

@ -721,6 +721,7 @@
#() vFffff
#() vFdddd
#() vFllii
#() vFLppi
#() vFpiii
#() vFpiiu
#() vFpiip
@ -1142,6 +1143,7 @@
#() vFfffff
#() vFddddp
#() vFluipp
#() vFLpppi
#() vFpiiii
#() vFpiiiI
#() vFpiiiu
@ -1583,6 +1585,7 @@
#() iFuppipp
#() iFuppppp
#() iFdipppL
#() iFLpppii
#() iFpiiiii
#() iFpiiiip
#() iFpiiipp
@ -2425,6 +2428,7 @@ wrappedappindicator:
wrappedappindicator3:
wrappedatk:
wrappedatkbridge:
wrappedatomic:
wrappedbz2:
- iFp:
- BZ2_bzCompressEnd

View File

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

View File

@ -0,0 +1,17 @@
/*******************************************************************
* File automatically generated by rebuild_wrappers.py (v2.0.0.11) *
*******************************************************************/
#ifndef __wrappedatomicTYPES_H_
#define __wrappedatomicTYPES_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 // __wrappedatomicTYPES_H_

View File

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

View File

@ -793,6 +793,7 @@ typedef void (*vFUUpi_t)(uint64_t, uint64_t, void*, int32_t);
typedef void (*vFffff_t)(float, float, float, float);
typedef void (*vFdddd_t)(double, double, double, double);
typedef void (*vFllii_t)(intptr_t, intptr_t, int32_t, int32_t);
typedef void (*vFLppi_t)(uintptr_t, void*, void*, int32_t);
typedef void (*vFpiii_t)(void*, int32_t, int32_t, int32_t);
typedef void (*vFpiiu_t)(void*, int32_t, int32_t, uint32_t);
typedef void (*vFpiip_t)(void*, int32_t, int32_t, void*);
@ -1214,6 +1215,7 @@ typedef void (*vFupppp_t)(uint32_t, void*, void*, void*, void*);
typedef void (*vFfffff_t)(float, float, float, float, float);
typedef void (*vFddddp_t)(double, double, double, double, void*);
typedef void (*vFluipp_t)(intptr_t, uint32_t, int32_t, void*, void*);
typedef void (*vFLpppi_t)(uintptr_t, void*, void*, void*, int32_t);
typedef void (*vFpiiii_t)(void*, int32_t, int32_t, int32_t, int32_t);
typedef void (*vFpiiiI_t)(void*, int32_t, int32_t, int32_t, int64_t);
typedef void (*vFpiiiu_t)(void*, int32_t, int32_t, int32_t, uint32_t);
@ -1655,6 +1657,7 @@ typedef int32_t (*iFippppp_t)(int32_t, void*, void*, void*, void*, void*);
typedef int32_t (*iFuppipp_t)(uint32_t, void*, void*, int32_t, void*, void*);
typedef int32_t (*iFuppppp_t)(uint32_t, void*, void*, void*, void*, void*);
typedef int32_t (*iFdipppL_t)(double, int32_t, void*, void*, void*, uintptr_t);
typedef int32_t (*iFLpppii_t)(uintptr_t, void*, void*, void*, int32_t, int32_t);
typedef int32_t (*iFpiiiii_t)(void*, int32_t, int32_t, int32_t, int32_t, int32_t);
typedef int32_t (*iFpiiiip_t)(void*, int32_t, int32_t, int32_t, int32_t, void*);
typedef int32_t (*iFpiiipp_t)(void*, int32_t, int32_t, int32_t, void*, void*);
@ -3225,6 +3228,7 @@ void vFUUpi(x86emu_t *emu, uintptr_t fcn) { vFUUpi_t fn = (vFUUpi_t)fcn; fn(*(ui
void vFffff(x86emu_t *emu, uintptr_t fcn) { vFffff_t fn = (vFffff_t)fcn; fn(*(float*)(R_ESP + 4), *(float*)(R_ESP + 8), *(float*)(R_ESP + 12), *(float*)(R_ESP + 16)); }
void vFdddd(x86emu_t *emu, uintptr_t fcn) { vFdddd_t fn = (vFdddd_t)fcn; fn(*(double*)(R_ESP + 4), *(double*)(R_ESP + 12), *(double*)(R_ESP + 20), *(double*)(R_ESP + 28)); }
void vFllii(x86emu_t *emu, uintptr_t fcn) { vFllii_t fn = (vFllii_t)fcn; fn(*(intptr_t*)(R_ESP + 4), *(intptr_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(int32_t*)(R_ESP + 16)); }
void vFLppi(x86emu_t *emu, uintptr_t fcn) { vFLppi_t fn = (vFLppi_t)fcn; fn(*(uintptr_t*)(R_ESP + 4), *(void**)(R_ESP + 8), *(void**)(R_ESP + 12), *(int32_t*)(R_ESP + 16)); }
void vFpiii(x86emu_t *emu, uintptr_t fcn) { vFpiii_t fn = (vFpiii_t)fcn; fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(int32_t*)(R_ESP + 16)); }
void vFpiiu(x86emu_t *emu, uintptr_t fcn) { vFpiiu_t fn = (vFpiiu_t)fcn; fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(uint32_t*)(R_ESP + 16)); }
void vFpiip(x86emu_t *emu, uintptr_t fcn) { vFpiip_t fn = (vFpiip_t)fcn; fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(void**)(R_ESP + 16)); }
@ -3646,6 +3650,7 @@ void vFupppp(x86emu_t *emu, uintptr_t fcn) { vFupppp_t fn = (vFupppp_t)fcn; fn(*
void vFfffff(x86emu_t *emu, uintptr_t fcn) { vFfffff_t fn = (vFfffff_t)fcn; fn(*(float*)(R_ESP + 4), *(float*)(R_ESP + 8), *(float*)(R_ESP + 12), *(float*)(R_ESP + 16), *(float*)(R_ESP + 20)); }
void vFddddp(x86emu_t *emu, uintptr_t fcn) { vFddddp_t fn = (vFddddp_t)fcn; fn(*(double*)(R_ESP + 4), *(double*)(R_ESP + 12), *(double*)(R_ESP + 20), *(double*)(R_ESP + 28), *(void**)(R_ESP + 36)); }
void vFluipp(x86emu_t *emu, uintptr_t fcn) { vFluipp_t fn = (vFluipp_t)fcn; fn(*(intptr_t*)(R_ESP + 4), *(uint32_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(void**)(R_ESP + 16), *(void**)(R_ESP + 20)); }
void vFLpppi(x86emu_t *emu, uintptr_t fcn) { vFLpppi_t fn = (vFLpppi_t)fcn; fn(*(uintptr_t*)(R_ESP + 4), *(void**)(R_ESP + 8), *(void**)(R_ESP + 12), *(void**)(R_ESP + 16), *(int32_t*)(R_ESP + 20)); }
void vFpiiii(x86emu_t *emu, uintptr_t fcn) { vFpiiii_t fn = (vFpiiii_t)fcn; fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(int32_t*)(R_ESP + 16), *(int32_t*)(R_ESP + 20)); }
void vFpiiiI(x86emu_t *emu, uintptr_t fcn) { vFpiiiI_t fn = (vFpiiiI_t)fcn; fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(int32_t*)(R_ESP + 16), *(int64_t*)(R_ESP + 20)); }
void vFpiiiu(x86emu_t *emu, uintptr_t fcn) { vFpiiiu_t fn = (vFpiiiu_t)fcn; fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(int32_t*)(R_ESP + 16), *(uint32_t*)(R_ESP + 20)); }
@ -4087,6 +4092,7 @@ void iFippppp(x86emu_t *emu, uintptr_t fcn) { iFippppp_t fn = (iFippppp_t)fcn; R
void iFuppipp(x86emu_t *emu, uintptr_t fcn) { iFuppipp_t fn = (iFuppipp_t)fcn; R_EAX=fn(*(uint32_t*)(R_ESP + 4), *(void**)(R_ESP + 8), *(void**)(R_ESP + 12), *(int32_t*)(R_ESP + 16), *(void**)(R_ESP + 20), *(void**)(R_ESP + 24)); }
void iFuppppp(x86emu_t *emu, uintptr_t fcn) { iFuppppp_t fn = (iFuppppp_t)fcn; R_EAX=fn(*(uint32_t*)(R_ESP + 4), *(void**)(R_ESP + 8), *(void**)(R_ESP + 12), *(void**)(R_ESP + 16), *(void**)(R_ESP + 20), *(void**)(R_ESP + 24)); }
void iFdipppL(x86emu_t *emu, uintptr_t fcn) { iFdipppL_t fn = (iFdipppL_t)fcn; R_EAX=fn(*(double*)(R_ESP + 4), *(int32_t*)(R_ESP + 12), *(void**)(R_ESP + 16), *(void**)(R_ESP + 20), *(void**)(R_ESP + 24), *(uintptr_t*)(R_ESP + 28)); }
void iFLpppii(x86emu_t *emu, uintptr_t fcn) { iFLpppii_t fn = (iFLpppii_t)fcn; R_EAX=fn(*(uintptr_t*)(R_ESP + 4), *(void**)(R_ESP + 8), *(void**)(R_ESP + 12), *(void**)(R_ESP + 16), *(int32_t*)(R_ESP + 20), *(int32_t*)(R_ESP + 24)); }
void iFpiiiii(x86emu_t *emu, uintptr_t fcn) { iFpiiiii_t fn = (iFpiiiii_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(int32_t*)(R_ESP + 16), *(int32_t*)(R_ESP + 20), *(int32_t*)(R_ESP + 24)); }
void iFpiiiip(x86emu_t *emu, uintptr_t fcn) { iFpiiiip_t fn = (iFpiiiip_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(int32_t*)(R_ESP + 16), *(int32_t*)(R_ESP + 20), *(void**)(R_ESP + 24)); }
void iFpiiipp(x86emu_t *emu, uintptr_t fcn) { iFpiiipp_t fn = (iFpiiipp_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(int32_t*)(R_ESP + 16), *(void**)(R_ESP + 20), *(void**)(R_ESP + 24)); }

View File

@ -753,6 +753,7 @@ void vFUUpi(x86emu_t *emu, uintptr_t fnc);
void vFffff(x86emu_t *emu, uintptr_t fnc);
void vFdddd(x86emu_t *emu, uintptr_t fnc);
void vFllii(x86emu_t *emu, uintptr_t fnc);
void vFLppi(x86emu_t *emu, uintptr_t fnc);
void vFpiii(x86emu_t *emu, uintptr_t fnc);
void vFpiiu(x86emu_t *emu, uintptr_t fnc);
void vFpiip(x86emu_t *emu, uintptr_t fnc);
@ -1174,6 +1175,7 @@ void vFupppp(x86emu_t *emu, uintptr_t fnc);
void vFfffff(x86emu_t *emu, uintptr_t fnc);
void vFddddp(x86emu_t *emu, uintptr_t fnc);
void vFluipp(x86emu_t *emu, uintptr_t fnc);
void vFLpppi(x86emu_t *emu, uintptr_t fnc);
void vFpiiii(x86emu_t *emu, uintptr_t fnc);
void vFpiiiI(x86emu_t *emu, uintptr_t fnc);
void vFpiiiu(x86emu_t *emu, uintptr_t fnc);
@ -1615,6 +1617,7 @@ void iFippppp(x86emu_t *emu, uintptr_t fnc);
void iFuppipp(x86emu_t *emu, uintptr_t fnc);
void iFuppppp(x86emu_t *emu, uintptr_t fnc);
void iFdipppL(x86emu_t *emu, uintptr_t fnc);
void iFLpppii(x86emu_t *emu, uintptr_t fnc);
void iFpiiiii(x86emu_t *emu, uintptr_t fnc);
void iFpiiiip(x86emu_t *emu, uintptr_t fnc);
void iFpiiipp(x86emu_t *emu, uintptr_t fnc);

View File

@ -0,0 +1,18 @@
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dlfcn.h>
#include "wrappedlibs.h"
#include "wrapper.h"
#include "bridge.h"
#include "librarian/library_private.h"
#include "x86emu.h"
const char* atomicName = "libatomic.so.1";
#define LIBNAME atomic
#include "wrappedlib_init.h"

View File

@ -0,0 +1,101 @@
#if !(defined(GO) && defined(GOM) && defined(GO2) && defined(DATA))
#error Meh....
#endif
//GO(__atomic_add_fetch_1,
//GO(__atomic_add_fetch_16,
//GO(__atomic_add_fetch_2,
//GO(__atomic_add_fetch_4,
//GO(__atomic_add_fetch_8,
//GO(__atomic_and_fetch_1,
//GO(__atomic_and_fetch_16,
//GO(__atomic_and_fetch_2,
//GO(__atomic_and_fetch_4,
//GO(__atomic_and_fetch_8,
GO(__atomic_compare_exchange, iFLpppii)
//GO(__atomic_compare_exchange_1,
//GO(__atomic_compare_exchange_16,
//GO(__atomic_compare_exchange_2,
//GO(__atomic_compare_exchange_4,
//GO(__atomic_compare_exchange_8,
GO(__atomic_exchange, vFLpppi)
//GO(__atomic_exchange_1,
//GO(__atomic_exchange_16,
//GO(__atomic_exchange_2,
//GO(__atomic_exchange_4,
//GO(__atomic_exchange_8,
//GO(__atomic_feraiseexcept,
//GO(__atomic_fetch_add_1,
//GO(__atomic_fetch_add_16,
//GO(__atomic_fetch_add_2,
//GO(__atomic_fetch_add_4,
//GO(__atomic_fetch_add_8,
//GO(__atomic_fetch_and_1,
//GO(__atomic_fetch_and_16,
//GO(__atomic_fetch_and_2,
//GO(__atomic_fetch_and_4,
//GO(__atomic_fetch_and_8,
//GO(__atomic_fetch_nand_1,
//GO(__atomic_fetch_nand_16,
//GO(__atomic_fetch_nand_2,
//GO(__atomic_fetch_nand_4,
//GO(__atomic_fetch_nand_8,
//GO(__atomic_fetch_or_1,
//GO(__atomic_fetch_or_16,
//GO(__atomic_fetch_or_2,
//GO(__atomic_fetch_or_4,
//GO(__atomic_fetch_or_8,
//GO(__atomic_fetch_sub_1,
//GO(__atomic_fetch_sub_16,
//GO(__atomic_fetch_sub_2,
//GO(__atomic_fetch_sub_4,
//GO(__atomic_fetch_sub_8,
//GO(__atomic_fetch_xor_1,
//GO(__atomic_fetch_xor_16,
//GO(__atomic_fetch_xor_2,
//GO(__atomic_fetch_xor_4,
//GO(__atomic_fetch_xor_8,
//GO(atomic_flag_clear,
//GO(atomic_flag_clear_explicit,
//GO(atomic_flag_test_and_set,
//GO(atomic_flag_test_and_set_explicit,
GO(__atomic_is_lock_free, iFLp)
GO(__atomic_load, vFLppi)
//GO(__atomic_load_1,
//GO(__atomic_load_16,
//GO(__atomic_load_2,
//GO(__atomic_load_4,
//GO(__atomic_load_8,
//GO(__atomic_nand_fetch_1,
//GO(__atomic_nand_fetch_16,
//GO(__atomic_nand_fetch_2,
//GO(__atomic_nand_fetch_4,
//GO(__atomic_nand_fetch_8,
//GO(__atomic_or_fetch_1,
//GO(__atomic_or_fetch_16,
//GO(__atomic_or_fetch_2,
//GO(__atomic_or_fetch_4,
//GO(__atomic_or_fetch_8,
//GO(atomic_signal_fence,
GO(__atomic_store, vFLppi)
//GO(__atomic_store_1,
//GO(__atomic_store_16,
//GO(__atomic_store_2,
//GO(__atomic_store_4,
//GO(__atomic_store_8,
//GO(__atomic_sub_fetch_1,
//GO(__atomic_sub_fetch_16,
//GO(__atomic_sub_fetch_2,
//GO(__atomic_sub_fetch_4,
//GO(__atomic_sub_fetch_8,
//GO(__atomic_test_and_set_1,
//GO(__atomic_test_and_set_16,
//GO(__atomic_test_and_set_2,
//GO(__atomic_test_and_set_4,
//GO(__atomic_test_and_set_8,
//GO(atomic_thread_fence,
//GO(__atomic_xor_fetch_1,
//GO(__atomic_xor_fetch_16,
//GO(__atomic_xor_fetch_2,
//GO(__atomic_xor_fetch_4,
//GO(__atomic_xor_fetch_8,