From 9bdf5e5843223ba5240cf785d2cbb88773ccb681 Mon Sep 17 00:00:00 2001 From: Andrea Fioraldi Date: Tue, 31 Oct 2023 16:36:33 +0100 Subject: [PATCH] Non thread local bpt globals in fullsystem --- accel/tcg/tcg-runtime.c | 7 ++++++- cpu-target.c | 4 ++++ system/cpus.c | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/accel/tcg/tcg-runtime.c b/accel/tcg/tcg-runtime.c index 2ef77cb924..5daa5e7a6b 100644 --- a/accel/tcg/tcg-runtime.c +++ b/accel/tcg/tcg-runtime.c @@ -132,10 +132,15 @@ void libafl_load_qemu_snapshot(char *name, bool sync) #define EXCP_LIBAFL_BP 0xf4775747 +#ifdef CONFIG_USER_ONLY __thread int libafl_qemu_break_asap = 0; - __thread CPUState* libafl_breakpoint_cpu; __thread vaddr libafl_breakpoint_pc; +#else +int libafl_qemu_break_asap = 0; +CPUState* libafl_breakpoint_cpu; +vaddr libafl_breakpoint_pc; +#endif #ifdef TARGET_ARM #define THUMB_MASK(value) (value | cpu_env(libafl_breakpoint_cpu)->thumb) diff --git a/cpu-target.c b/cpu-target.c index cde63343f4..cc2d84b4a2 100644 --- a/cpu-target.c +++ b/cpu-target.c @@ -96,7 +96,11 @@ int libafl_qemu_remove_hook(size_t num, int invalidate); struct libafl_hook* libafl_search_hook(target_ulong addr); void libafl_flush_jit(void); +#ifdef CONFIG_USER_ONLY extern __thread CPUState* libafl_breakpoint_cpu; +#else +extern CPUState* libafl_breakpoint_cpu; +#endif extern int libafl_restoring_devices; diff --git a/system/cpus.c b/system/cpus.c index fcc54c1c4c..556129385e 100644 --- a/system/cpus.c +++ b/system/cpus.c @@ -714,7 +714,7 @@ int vm_prepare_start(bool step_pending) //// --- Begin LibAFL code --- -extern __thread CPUState* libafl_breakpoint_cpu; +extern CPUState* libafl_breakpoint_cpu; //// --- End LibAFL code ---