tcg: Record code_gen_buffer address for user-only memory helpers

When we handle a signal from a fault within a user-only memory helper,
we cannot cpu_restore_state with the PC found within the signal frame.
Use a TLS variable, helper_retaddr, to record the unwind start point
to find the faulting guest insn.

Backports commit ec603b5584fa71213ef8f324fe89e4b27cc9d2bc from qemu
This commit is contained in:
Richard Henderson 2018-03-05 12:01:31 -05:00 committed by Lioncash
parent 7ec1f12429
commit f76eb22a46
No known key found for this signature in database
GPG Key ID: 4E3C3CC1031BA9C7
2 changed files with 4 additions and 0 deletions

View File

@ -195,6 +195,9 @@ struct uc_struct {
BounceBuffer bounce;
CPUState *tcg_current_rr_cpu;
// qemu/user-exec.c
QEMU_THREAD_LOCAL_VAR helper_retaddr;
// qemu/memory.c
bool global_dirty_log;

View File

@ -666,6 +666,7 @@ static void *atomic_mmu_lookup(CPUArchState *env, target_ulong addr,
#define ATOMIC_NAME(X) \
HELPER(glue(glue(glue(atomic_ ## X, SUFFIX), END), _mmu))
#define ATOMIC_MMU_LOOKUP atomic_mmu_lookup(env, addr, oi, retaddr)
#define ATOMIC_MMU_CLEANUP do { } while (0)
#define DATA_SIZE 1
#include "atomic_template.h"