Save jit state before/after callback
This commit is contained in:
@@ -63,6 +63,28 @@ __attribute__((unused)) static bool thread_executable()
|
||||
return thread_mask() == 1;
|
||||
}
|
||||
|
||||
#define JIT_CALLBACK_GUARD(x) \
|
||||
{ \
|
||||
bool executable = uc->current_executable; \
|
||||
assert (executable == thread_executable()); \
|
||||
x; \
|
||||
if (executable != thread_executable()) { \
|
||||
jit_write_protect(executable); \
|
||||
} \
|
||||
} \
|
||||
|
||||
|
||||
#define JIT_CALLBACK_GUARD_VAR(var, x) \
|
||||
{ \
|
||||
bool executable = uc->current_executable; \
|
||||
assert (executable == thread_executable()); \
|
||||
var = x; \
|
||||
if (executable != thread_executable()) { \
|
||||
jit_write_protect(executable); \
|
||||
} \
|
||||
} \
|
||||
|
||||
|
||||
#else /* defined(__aarch64__) && defined(CONFIG_DARWIN) */
|
||||
|
||||
static inline void jit_write_protect(int enabled)
|
||||
@@ -70,6 +92,19 @@ static inline void jit_write_protect(int enabled)
|
||||
return;
|
||||
}
|
||||
|
||||
#define JIT_CALLBACK_GUARD(x) \
|
||||
{ \
|
||||
(void*)uc; \
|
||||
x; \
|
||||
} \
|
||||
|
||||
|
||||
#define JIT_CALLBACK_GUARD_VAR(var, x) \
|
||||
{ \
|
||||
(void*)uc; \
|
||||
var = x; \
|
||||
} \
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* define TCG_APPLE_JIT_H */
|
||||
Reference in New Issue
Block a user