Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/include/myalign.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,14 +243,14 @@ typedef struct jump_buff_x64_s {

typedef struct __jmp_buf_tag_s {
jump_buff_x64_t __jmpbuf;
int __mask_was_saved;
int __mask_was_saved;
#ifdef ANDROID
union {
sigset_t __saved_mask;
sigset64_t __saved_mask64;
sigset_t __saved_mask;
sigset64_t __saved_mask64;
};
#else
__sigset_t __saved_mask;
sigset_t __saved_mask;
#endif
} __jmp_buf_tag_t;

Expand Down
6 changes: 3 additions & 3 deletions src/include/myalign32.h
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,8 @@ struct i386_passwd
{
ptr_t pw_name; // char*
ptr_t pw_passwd; // char*
__uid_t pw_uid;
__gid_t pw_gid;
uid_t pw_uid;
gid_t pw_gid;
ptr_t pw_gecos; // char*
ptr_t pw_dir; // char*
ptr_t pw_shell; // char*
Expand All @@ -579,7 +579,7 @@ struct i386_group
{
ptr_t gr_name; // char *
ptr_t gr_passwd; // char *
__gid_t gr_gid;
gid_t gr_gid;
ptr_t gr_mem; // char **
} __attribute__((packed, aligned(4)));

Expand Down
6 changes: 6 additions & 0 deletions src/include/os.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,15 @@ struct box64ec_jmpbuf_s { uint64_t regs[18]; }; // see Box64EC_SetJmp in modu
#define GET_JUMPBUFF(name) NULL
#endif

#ifndef PROT_READ
#define PROT_READ 0x1
#endif
#ifndef PROT_WRITE
#define PROT_WRITE 0x2
#endif
#ifndef PROT_EXEC
#define PROT_EXEC 0x4
#endif

void PrintfFtrace(int prefix, const char* fmt, ...);

Expand Down
12 changes: 6 additions & 6 deletions src/libtools/signal32.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,22 +269,22 @@ typedef struct __attribute__((packed, aligned(4))) my_siginfo32_s
union {
int _pad[128/sizeof(int)-3];
struct {
__pid_t __si_pid;
__uid_t __si_uid;
pid_t __si_pid;
uid_t __si_uid;
} _kill;
struct {
int si_tid;
int __si_overrun;
my_sigval32_t si_sigval;
} _timer;
struct {
__pid_t __si_pid;
__uid_t __si_uid;
pid_t __si_pid;
uid_t __si_uid;
my_sigval32_t si_sigval;
} _rt;
struct {
__pid_t __si_pid;
__uid_t __si_uid;
pid_t __si_pid;
uid_t __si_uid;
int __si_status;
int32_t __si_utime;
int32_t __si_stime;
Expand Down
2 changes: 1 addition & 1 deletion src/libtools/threads.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ _Atomic int g_active_emu_workers = 0;
typedef void (*vFppp_t)(void*, void*, void*);
typedef void (*vFpi_t)(void*, int);
typedef int (*iFppip_t)(void*, void*, int, void*);
typedef int (*iFli_t)(long unsigned int, int);
typedef int (*iFli_t)(pthread_t, int);
typedef struct emuthread_s emuthread_t;

static vFppp_t real_pthread_cleanup_push_defer = NULL;
Expand Down
6 changes: 3 additions & 3 deletions src/libtools/threads32.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
typedef void (*vFppp_t)(void*, void*, void*);
typedef void (*vFpi_t)(void*, int);
typedef int (*iFv_t)(void);
typedef int (*iFLi_t)(unsigned long, int);
typedef int (*iFLi_t)(pthread_t, int);
//starting with glibc 2.34+, those 2 functions are in libc.so as versioned symbol only
// So use dlsym to get the symbol unversioned, as simple link will not work.
static vFppp_t real_pthread_cleanup_push_defer = NULL;
Expand Down Expand Up @@ -692,8 +692,8 @@ EXPORT int my32_pthread_attr_init(x64emu_t* emu, void* attr)
EXPORT int my32_pthread_getattr_np(x64emu_t* emu, uintptr_t th, void* attr)
{
(void)emu;
int ret = pthread_getattr_np(th, get_attr(attr));
if(!ret && th==pthread_self()) {
int ret = pthread_getattr_np((pthread_t) th, get_attr(attr));
if(!ret && (pthread_t) th == pthread_self()) {
if(!emu->context->stacksizes) {
emu->context->stacksizes = kh_init(threadstack);
}
Expand Down
11 changes: 6 additions & 5 deletions src/wrapped/wrappedlibc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1896,21 +1896,22 @@ typedef struct compare_r_s {
int r;
} compare_r_t;

static int my_compare_r_cb(void* a, void* b, compare_r_t* arg)
static int my_compare_r_cb(const void* a, const void* b, void* userdata)
{
return (int)RunFunctionWithEmu(arg->emu, 0, arg->f, 2+arg->r, a, b, arg->data);
compare_r_t* arg = userdata;
return (int)RunFunctionWithEmu(arg->emu, 0, arg->f, 2+arg->r, (void*)a, (void*)b, arg->data);
}
EXPORT void my_qsort(x64emu_t* emu, void* base, size_t nmemb, size_t size, void* fnc)
{
compare_r_t args;
args.emu = emu; args.f = (uintptr_t)fnc; args.r = 0; args.data = NULL;
qsort_r(base, nmemb, size, (__compar_d_fn_t)my_compare_r_cb, &args);
qsort_r(base, nmemb, size, my_compare_r_cb, &args);
}
EXPORT void my_qsort_r(x64emu_t* emu, void* base, size_t nmemb, size_t size, void* fnc, void* data)
{
compare_r_t args;
args.emu = emu; args.f = (uintptr_t)fnc; args.r = 1; args.data = data;
qsort_r(base, nmemb, size, (__compar_d_fn_t)my_compare_r_cb, &args);
qsort_r(base, nmemb, size, my_compare_r_cb, &args);
}
EXPORT void* my_bsearch(x64emu_t* emu, void* key, void* base, size_t nmemb, size_t size, void* fnc)
{
Expand Down Expand Up @@ -4849,7 +4850,7 @@ EXPORT int my_stime(x64emu_t* emu, const time_t *t)
}

int GetTID();
#ifdef ANDROID
#if defined(ANDROID) || ! defined(__GLIBC__)
void updateGlibcTidCache() {}
#else
struct glibc_pthread {
Expand Down
9 changes: 5 additions & 4 deletions src/wrapped32/wrappedlibc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1456,23 +1456,24 @@ typedef struct compare_r_s {
int r;
} compare_r_t;

static int my32_compare_r_cb(void* a, void* b, compare_r_t* arg)
static int my32_compare_r_cb(const void* a, const void* b, void* userdata)
{
return (int)RunFunctionWithEmu(arg->emu, 0, arg->f, 2+arg->r, a, b, arg->data);
compare_r_t* arg = userdata;
return (int)RunFunctionWithEmu(arg->emu, 0, arg->f, 2+arg->r, (void*)a, (void*)b, arg->data);
}

#ifndef ANDROID
EXPORT void my32_qsort(x64emu_t* emu, void* base, size_t nmemb, size_t size, void* fnc)
{
compare_r_t args;
args.emu = emu; args.f = (uintptr_t)fnc; args.r = 0; args.data = NULL;
qsort_r(base, nmemb, size, (__compar_d_fn_t)my32_compare_r_cb, &args);
qsort_r(base, nmemb, size, my32_compare_r_cb, &args);
}
EXPORT void my32_qsort_r(x64emu_t* emu, void* base, size_t nmemb, size_t size, void* fnc, void* data)
{
compare_r_t args;
args.emu = emu; args.f = (uintptr_t)fnc; args.r = 1; args.data = data;
qsort_r(base, nmemb, size, (__compar_d_fn_t)my32_compare_r_cb, &args);
qsort_r(base, nmemb, size, my32_compare_r_cb, &args);
}
#endif

Expand Down
Loading