1
0
mirror of https://github.com/termux/termux-packages synced 2024-06-17 12:47:08 +00:00
termux-packages/packages/box86/src_dynarec_dynablock.c.patch

38 lines
1.1 KiB
Diff

diff -uNr box86/src/dynarec/dynablock.c box86.mod/src/dynarec/dynablock.c
--- box86/src/dynarec/dynablock.c 2022-10-31 00:09:49.883470723 +0800
+++ box86.mod/src/dynarec/dynablock.c 2022-10-31 00:08:16.999470789 +0800
@@ -299,12 +299,21 @@
}
//TODO: move this to dynrec_arm.c and track allocated structure to avoid memory leak
+#ifdef ANDROID
+static __thread jmp_buf dynarec_jmpbuf;
+
+void cancelFillBlock()
+{
+ longjmp(dynarec_jmpbuf, 1);
+}
+#else
static __thread struct __jmp_buf_tag dynarec_jmpbuf;
void cancelFillBlock()
{
longjmp(&dynarec_jmpbuf, 1);
}
+#endif
/*
return NULL if block is not found / cannot be created.
@@ -343,7 +352,11 @@
block->x86_addr = (void*)addr;
if(need_lock)
pthread_mutex_lock(&my_context->mutex_dyndump);
+#ifdef ANDROID
+ if(sigsetjmp(dynarec_jmpbuf, 1)) {
+#else
if(sigsetjmp(&dynarec_jmpbuf, 1)) {
+#endif
printf_log(LOG_INFO, "FillBlock at %p triggered a segfault, cancelling\n", (void*)addr);
if(need_lock)
pthread_mutex_unlock(&my_context->mutex_dyndump);