about summary refs log tree commit diff stats
path: root/src/libtools/threads32.c
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-08-28 18:35:24 +0200
committerptitSeb <sebastien.chev@gmail.com>2024-08-28 18:35:24 +0200
commit126c59b4a41b3f17b4fdea6e1fd94bd15d1638d7 (patch)
treef4ddcd2506cc59d159dc9e937e4bbab53e0b4b23 /src/libtools/threads32.c
parentb7be225846153a1ed44b149b6600fb86c3fa0b42 (diff)
downloadbox64-126c59b4a41b3f17b4fdea6e1fd94bd15d1638d7.tar.gz
box64-126c59b4a41b3f17b4fdea6e1fd94bd15d1638d7.zip
[BOX32] More wrapped 32bits functions, and some fixes too
Diffstat (limited to 'src/libtools/threads32.c')
-rwxr-xr-xsrc/libtools/threads32.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libtools/threads32.c b/src/libtools/threads32.c
index 1fc3a2df..bab4cf4f 100755
--- a/src/libtools/threads32.c
+++ b/src/libtools/threads32.c
@@ -293,6 +293,20 @@ EXPORT void my32___pthread_unregister_cancel(x64emu_t* emu, x64_unwind_buff_t* b
 	}
 }
 
+#define X86_RWLOCK_SIZE	32
+EXPORT int my32_pthread_rwlock_init(void* rdlock, void* attr)
+{
+	// the structure is bigger, but the "active" part should be the same size, so just save/restoore the padding at init
+	uint8_t buff[sizeof(pthread_rwlock_t)];
+	if(rdlock && sizeof(pthread_rwlock_t)>X86_RWLOCK_SIZE) {
+		memcpy(buff, rdlock+32, sizeof(pthread_rwlock_t)-X86_RWLOCK_SIZE);
+	}
+	int ret = pthread_rwlock_init(rdlock, attr);
+	memcpy(rdlock+32, buff, sizeof(pthread_rwlock_t)-X86_RWLOCK_SIZE);
+	return ret;
+}
+EXPORT int my32___pthread_rwlock_init(void*, void*) __attribute__((alias("my32_pthread_rwlock_init")));
+
 EXPORT void my32___pthread_unwind_next(x64emu_t* emu, void* p)
 {
 	emu->quit = 1;