mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 02:24:58 -06:00
accel/tcg: Replace CPUState.env_ptr with cpu_env()
Reviewed-by: Anton Johansson <anjo@rev.ng> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
ad75a51e84
commit
b77af26e97
58 changed files with 152 additions and 155 deletions
|
@ -78,7 +78,7 @@ nvmm_set_segment(struct nvmm_x64_state_seg *nseg, const SegmentCache *qseg)
|
|||
static void
|
||||
nvmm_set_registers(CPUState *cpu)
|
||||
{
|
||||
CPUX86State *env = cpu->env_ptr;
|
||||
CPUX86State *env = cpu_env(cpu);
|
||||
struct nvmm_machine *mach = get_nvmm_mach();
|
||||
AccelCPUState *qcpu = cpu->accel;
|
||||
struct nvmm_vcpu *vcpu = &qcpu->vcpu;
|
||||
|
@ -215,7 +215,7 @@ nvmm_get_segment(SegmentCache *qseg, const struct nvmm_x64_state_seg *nseg)
|
|||
static void
|
||||
nvmm_get_registers(CPUState *cpu)
|
||||
{
|
||||
CPUX86State *env = cpu->env_ptr;
|
||||
CPUX86State *env = cpu_env(cpu);
|
||||
struct nvmm_machine *mach = get_nvmm_mach();
|
||||
AccelCPUState *qcpu = cpu->accel;
|
||||
struct nvmm_vcpu *vcpu = &qcpu->vcpu;
|
||||
|
@ -340,7 +340,7 @@ nvmm_get_registers(CPUState *cpu)
|
|||
static bool
|
||||
nvmm_can_take_int(CPUState *cpu)
|
||||
{
|
||||
CPUX86State *env = cpu->env_ptr;
|
||||
CPUX86State *env = cpu_env(cpu);
|
||||
AccelCPUState *qcpu = cpu->accel;
|
||||
struct nvmm_vcpu *vcpu = &qcpu->vcpu;
|
||||
struct nvmm_machine *mach = get_nvmm_mach();
|
||||
|
@ -387,7 +387,7 @@ nvmm_can_take_nmi(CPUState *cpu)
|
|||
static void
|
||||
nvmm_vcpu_pre_run(CPUState *cpu)
|
||||
{
|
||||
CPUX86State *env = cpu->env_ptr;
|
||||
CPUX86State *env = cpu_env(cpu);
|
||||
struct nvmm_machine *mach = get_nvmm_mach();
|
||||
AccelCPUState *qcpu = cpu->accel;
|
||||
struct nvmm_vcpu *vcpu = &qcpu->vcpu;
|
||||
|
@ -473,8 +473,8 @@ static void
|
|||
nvmm_vcpu_post_run(CPUState *cpu, struct nvmm_vcpu_exit *exit)
|
||||
{
|
||||
AccelCPUState *qcpu = cpu->accel;
|
||||
CPUX86State *env = cpu->env_ptr;
|
||||
X86CPU *x86_cpu = X86_CPU(cpu);
|
||||
CPUX86State *env = &x86_cpu->env;
|
||||
uint64_t tpr;
|
||||
|
||||
env->eflags = exit->exitstate.rflags;
|
||||
|
@ -645,7 +645,7 @@ static int
|
|||
nvmm_handle_halted(struct nvmm_machine *mach, CPUState *cpu,
|
||||
struct nvmm_vcpu_exit *exit)
|
||||
{
|
||||
CPUX86State *env = cpu->env_ptr;
|
||||
CPUX86State *env = cpu_env(cpu);
|
||||
int ret = 0;
|
||||
|
||||
qemu_mutex_lock_iothread();
|
||||
|
@ -678,11 +678,11 @@ nvmm_inject_ud(struct nvmm_machine *mach, struct nvmm_vcpu *vcpu)
|
|||
static int
|
||||
nvmm_vcpu_loop(CPUState *cpu)
|
||||
{
|
||||
CPUX86State *env = cpu->env_ptr;
|
||||
struct nvmm_machine *mach = get_nvmm_mach();
|
||||
AccelCPUState *qcpu = cpu->accel;
|
||||
struct nvmm_vcpu *vcpu = &qcpu->vcpu;
|
||||
X86CPU *x86_cpu = X86_CPU(cpu);
|
||||
CPUX86State *env = &x86_cpu->env;
|
||||
struct nvmm_vcpu_exit *exit = vcpu->exit;
|
||||
int ret;
|
||||
|
||||
|
|
|
@ -1595,7 +1595,7 @@ illegal:
|
|||
*/
|
||||
static void disas_insn_new(DisasContext *s, CPUState *cpu, int b)
|
||||
{
|
||||
CPUX86State *env = cpu->env_ptr;
|
||||
CPUX86State *env = cpu_env(cpu);
|
||||
bool first = true;
|
||||
X86DecodedInsn decode;
|
||||
X86DecodeFunc decode_func = decode_root;
|
||||
|
|
|
@ -597,7 +597,7 @@ bool x86_cpu_tlb_fill(CPUState *cs, vaddr addr, int size,
|
|||
MMUAccessType access_type, int mmu_idx,
|
||||
bool probe, uintptr_t retaddr)
|
||||
{
|
||||
CPUX86State *env = cs->env_ptr;
|
||||
CPUX86State *env = cpu_env(cs);
|
||||
TranslateResult out;
|
||||
TranslateFault err;
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ static void x86_cpu_synchronize_from_tb(CPUState *cs,
|
|||
{
|
||||
/* The instruction pointer is always up to date with CF_PCREL. */
|
||||
if (!(tb_cflags(tb) & CF_PCREL)) {
|
||||
CPUX86State *env = cs->env_ptr;
|
||||
CPUX86State *env = cpu_env(cs);
|
||||
env->eip = tb->pc - tb->cs_base;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3079,7 +3079,7 @@ static void gen_cmpxchg16b(DisasContext *s, CPUX86State *env, int modrm)
|
|||
be stopped. Return the next pc value */
|
||||
static bool disas_insn(DisasContext *s, CPUState *cpu)
|
||||
{
|
||||
CPUX86State *env = cpu->env_ptr;
|
||||
CPUX86State *env = cpu_env(cpu);
|
||||
int b, prefixes;
|
||||
int shift;
|
||||
MemOp ot, aflag, dflag;
|
||||
|
@ -6918,7 +6918,7 @@ void tcg_x86_init(void)
|
|||
static void i386_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cpu)
|
||||
{
|
||||
DisasContext *dc = container_of(dcbase, DisasContext, base);
|
||||
CPUX86State *env = cpu->env_ptr;
|
||||
CPUX86State *env = cpu_env(cpu);
|
||||
uint32_t flags = dc->base.tb->flags;
|
||||
uint32_t cflags = tb_cflags(dc->base.tb);
|
||||
int cpl = (flags >> HF_CPL_SHIFT) & 3;
|
||||
|
|
|
@ -300,7 +300,7 @@ static SegmentCache whpx_seg_h2q(const WHV_X64_SEGMENT_REGISTER *hs)
|
|||
/* X64 Extended Control Registers */
|
||||
static void whpx_set_xcrs(CPUState *cpu)
|
||||
{
|
||||
CPUX86State *env = cpu->env_ptr;
|
||||
CPUX86State *env = cpu_env(cpu);
|
||||
HRESULT hr;
|
||||
struct whpx_state *whpx = &whpx_global;
|
||||
WHV_REGISTER_VALUE xcr0;
|
||||
|
@ -321,7 +321,7 @@ static void whpx_set_xcrs(CPUState *cpu)
|
|||
|
||||
static int whpx_set_tsc(CPUState *cpu)
|
||||
{
|
||||
CPUX86State *env = cpu->env_ptr;
|
||||
CPUX86State *env = cpu_env(cpu);
|
||||
WHV_REGISTER_NAME tsc_reg = WHvX64RegisterTsc;
|
||||
WHV_REGISTER_VALUE tsc_val;
|
||||
HRESULT hr;
|
||||
|
@ -382,8 +382,8 @@ static void whpx_set_registers(CPUState *cpu, int level)
|
|||
{
|
||||
struct whpx_state *whpx = &whpx_global;
|
||||
AccelCPUState *vcpu = cpu->accel;
|
||||
CPUX86State *env = cpu->env_ptr;
|
||||
X86CPU *x86_cpu = X86_CPU(cpu);
|
||||
CPUX86State *env = &x86_cpu->env;
|
||||
struct whpx_register_set vcxt;
|
||||
HRESULT hr;
|
||||
int idx;
|
||||
|
@ -556,7 +556,7 @@ static void whpx_set_registers(CPUState *cpu, int level)
|
|||
|
||||
static int whpx_get_tsc(CPUState *cpu)
|
||||
{
|
||||
CPUX86State *env = cpu->env_ptr;
|
||||
CPUX86State *env = cpu_env(cpu);
|
||||
WHV_REGISTER_NAME tsc_reg = WHvX64RegisterTsc;
|
||||
WHV_REGISTER_VALUE tsc_val;
|
||||
HRESULT hr;
|
||||
|
@ -576,7 +576,7 @@ static int whpx_get_tsc(CPUState *cpu)
|
|||
/* X64 Extended Control Registers */
|
||||
static void whpx_get_xcrs(CPUState *cpu)
|
||||
{
|
||||
CPUX86State *env = cpu->env_ptr;
|
||||
CPUX86State *env = cpu_env(cpu);
|
||||
HRESULT hr;
|
||||
struct whpx_state *whpx = &whpx_global;
|
||||
WHV_REGISTER_VALUE xcr0;
|
||||
|
@ -601,8 +601,8 @@ static void whpx_get_registers(CPUState *cpu)
|
|||
{
|
||||
struct whpx_state *whpx = &whpx_global;
|
||||
AccelCPUState *vcpu = cpu->accel;
|
||||
CPUX86State *env = cpu->env_ptr;
|
||||
X86CPU *x86_cpu = X86_CPU(cpu);
|
||||
CPUX86State *env = &x86_cpu->env;
|
||||
struct whpx_register_set vcxt;
|
||||
uint64_t tpr, apic_base;
|
||||
HRESULT hr;
|
||||
|
@ -1400,7 +1400,7 @@ static vaddr whpx_vcpu_get_pc(CPUState *cpu, bool exit_context_valid)
|
|||
{
|
||||
if (cpu->vcpu_dirty) {
|
||||
/* The CPU registers have been modified by other parts of QEMU. */
|
||||
CPUArchState *env = (CPUArchState *)(cpu->env_ptr);
|
||||
CPUArchState *env = cpu_env(cpu);
|
||||
return env->eip;
|
||||
} else if (exit_context_valid) {
|
||||
/*
|
||||
|
@ -1439,7 +1439,7 @@ static vaddr whpx_vcpu_get_pc(CPUState *cpu, bool exit_context_valid)
|
|||
|
||||
static int whpx_handle_halt(CPUState *cpu)
|
||||
{
|
||||
CPUX86State *env = cpu->env_ptr;
|
||||
CPUX86State *env = cpu_env(cpu);
|
||||
int ret = 0;
|
||||
|
||||
qemu_mutex_lock_iothread();
|
||||
|
@ -1460,8 +1460,8 @@ static void whpx_vcpu_pre_run(CPUState *cpu)
|
|||
HRESULT hr;
|
||||
struct whpx_state *whpx = &whpx_global;
|
||||
AccelCPUState *vcpu = cpu->accel;
|
||||
CPUX86State *env = cpu->env_ptr;
|
||||
X86CPU *x86_cpu = X86_CPU(cpu);
|
||||
CPUX86State *env = &x86_cpu->env;
|
||||
int irq;
|
||||
uint8_t tpr;
|
||||
WHV_X64_PENDING_INTERRUPTION_REGISTER new_int;
|
||||
|
@ -1582,8 +1582,8 @@ static void whpx_vcpu_pre_run(CPUState *cpu)
|
|||
static void whpx_vcpu_post_run(CPUState *cpu)
|
||||
{
|
||||
AccelCPUState *vcpu = cpu->accel;
|
||||
CPUX86State *env = cpu->env_ptr;
|
||||
X86CPU *x86_cpu = X86_CPU(cpu);
|
||||
CPUX86State *env = &x86_cpu->env;
|
||||
|
||||
env->eflags = vcpu->exit_ctx.VpContext.Rflags;
|
||||
|
||||
|
@ -1606,8 +1606,8 @@ static void whpx_vcpu_post_run(CPUState *cpu)
|
|||
|
||||
static void whpx_vcpu_process_async_events(CPUState *cpu)
|
||||
{
|
||||
CPUX86State *env = cpu->env_ptr;
|
||||
X86CPU *x86_cpu = X86_CPU(cpu);
|
||||
CPUX86State *env = &x86_cpu->env;
|
||||
AccelCPUState *vcpu = cpu->accel;
|
||||
|
||||
if ((cpu->interrupt_request & CPU_INTERRUPT_INIT) &&
|
||||
|
@ -2147,8 +2147,8 @@ int whpx_init_vcpu(CPUState *cpu)
|
|||
struct whpx_state *whpx = &whpx_global;
|
||||
AccelCPUState *vcpu = NULL;
|
||||
Error *local_error = NULL;
|
||||
CPUX86State *env = cpu->env_ptr;
|
||||
X86CPU *x86_cpu = X86_CPU(cpu);
|
||||
CPUX86State *env = &x86_cpu->env;
|
||||
UINT64 freq = 0;
|
||||
int ret;
|
||||
|
||||
|
@ -2245,7 +2245,7 @@ int whpx_init_vcpu(CPUState *cpu)
|
|||
cpu->vcpu_dirty = true;
|
||||
cpu->accel = vcpu;
|
||||
max_vcpu_index = max(max_vcpu_index, cpu->cpu_index);
|
||||
qemu_add_vm_change_state_handler(whpx_cpu_update_state, cpu->env_ptr);
|
||||
qemu_add_vm_change_state_handler(whpx_cpu_update_state, env);
|
||||
|
||||
return 0;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue