tcg: Add type for vCPU pointers

Adds the 'TCGv_env' type for pointers to 'CPUArchState' objects. The
tracing infrastructure later needs to differentiate between regular
pointers and pointers to vCPUs.

Also changes all targets to use the new 'TCGv_env' type instead of the
generic 'TCGv_ptr'. As of now, the change is merely cosmetic ('TCGv_env'
translates into 'TCGv_ptr'), but that could change in the future to
enforce the difference.

Note that a 'TCGv_env' type (for 'CPUState') is not added, since all
helpers currently receive the architecture-specific
pointer ('CPUArchState').

Backports commit 1bcea73e13b2b059d0cb3301aeaca43e5656ef57 from qemu
This commit is contained in:
Lluís Vilanova 2018-02-20 22:53:46 -05:00 committed by Lioncash
parent 20712bcb9a
commit 7db1bffdee
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
2 changed files with 3 additions and 2 deletions

View file

@ -2432,7 +2432,7 @@ static void gen_fmovq(DisasContext *dc, DisasCompare *cmp, int rd, int rs)
gen_update_fprs_dirty(dc, qd); gen_update_fprs_dirty(dc, qd);
} }
static inline void gen_load_trap_state_at_tl(DisasContext *dc, TCGv_ptr r_tsptr, TCGv_ptr cpu_env) static inline void gen_load_trap_state_at_tl(DisasContext *dc, TCGv_ptr r_tsptr, TCGv_env cpu_env)
{ {
TCGContext *tcg_ctx = dc->uc->tcg_ctx; TCGContext *tcg_ctx = dc->uc->tcg_ctx;
TCGv_i32 r_tl = tcg_temp_new_i32(tcg_ctx); TCGv_i32 r_tl = tcg_temp_new_i32(tcg_ctx);

View file

@ -311,6 +311,7 @@ typedef tcg_target_ulong TCGArg;
typedef struct TCGv_i32_d *TCGv_i32; typedef struct TCGv_i32_d *TCGv_i32;
typedef struct TCGv_i64_d *TCGv_i64; typedef struct TCGv_i64_d *TCGv_i64;
typedef struct TCGv_ptr_d *TCGv_ptr; typedef struct TCGv_ptr_d *TCGv_ptr;
typedef TCGv_ptr TCGv_env;
static inline TCGv_i32 QEMU_ARTIFICIAL MAKE_TCGV_I32(intptr_t i) static inline TCGv_i32 QEMU_ARTIFICIAL MAKE_TCGV_I32(intptr_t i)
{ {
@ -719,7 +720,7 @@ struct TCGContext {
// Unicorn engine variables // Unicorn engine variables
struct uc_struct *uc; struct uc_struct *uc;
/* qemu/target-i386/translate.c: global register indexes */ /* qemu/target-i386/translate.c: global register indexes */
TCGv_ptr cpu_env; TCGv_env cpu_env;
TCGv_i32 cpu_cc_op; TCGv_i32 cpu_cc_op;
void *cpu_regs[16]; // 16 GRP for X86-64 void *cpu_regs[16]; // 16 GRP for X86-64
void *cpu_seg_base[6]; // Actually an array of TCGv void *cpu_seg_base[6]; // Actually an array of TCGv