On 5/28/20 9:37 PM, Roman Bolshakov wrote: > Drop and replace rip field from HVFX86EmulatorState in favor of eip from > common CPUX86State. > > Signed-off-by: Roman Bolshakov <r.bolsha...@yadro.com> > --- > target/i386/hvf/hvf.c | 6 +-- > target/i386/hvf/x86.h | 3 -- > target/i386/hvf/x86_decode.c | 6 +-- > target/i386/hvf/x86_emu.c | 86 ++++++++++++++++++------------------ > target/i386/hvf/x86_task.c | 4 +- > 5 files changed, 51 insertions(+), 54 deletions(-) > [...] > diff --git a/target/i386/hvf/x86.h b/target/i386/hvf/x86.h > index 56fcde13c6..e3ab7c5137 100644 > --- a/target/i386/hvf/x86.h > +++ b/target/i386/hvf/x86.h > @@ -294,7 +294,6 @@ typedef struct lazy_flags { > /* Definition of hvf_x86_state is here */ > struct HVFX86EmulatorState { > uint64_t fetch_rip; > - uint64_t rip; > struct x86_register regs[16]; > struct x86_reg_flags rflags; > struct lazy_flags lflags; > @@ -302,8 +301,6 @@ struct HVFX86EmulatorState { > }; > > /* useful register access macros */ > -#define RIP(cpu) (cpu->hvf_emul->rip) > -#define EIP(cpu) ((uint32_t)cpu->hvf_emul->rip) > #define RFLAGS(cpu) (cpu->hvf_emul->rflags.rflags) > #define EFLAGS(cpu) (cpu->hvf_emul->rflags.eflags) > [...] > diff --git a/target/i386/hvf/x86_task.c b/target/i386/hvf/x86_task.c > index 1daac6cc2b..834baec3ea 100644 > --- a/target/i386/hvf/x86_task.c > +++ b/target/i386/hvf/x86_task.c > @@ -38,7 +38,7 @@ static void save_state_to_tss32(CPUState *cpu, struct > x86_tss_segment32 *tss) > CPUX86State *env = &x86_cpu->env; > > /* CR3 and ldt selector are not saved intentionally */ > - tss->eip = EIP(env); > + tss->eip = (uint32_t)env->eip; > tss->eflags = EFLAGS(env); > tss->eax = EAX(env); > tss->ecx = ECX(env); > @@ -64,7 +64,7 @@ static void load_state_from_tss32(CPUState *cpu, struct > x86_tss_segment32 *tss) > > wvmcs(cpu->hvf_fd, VMCS_GUEST_CR3, tss->cr3); > > - RIP(env) = tss->eip; > + env->eip = tss->eip; > EFLAGS(env) = tss->eflags | 2; > > /* General purpose registers */ >
Reviewed-by: Philippe Mathieu-Daudé <phi...@redhat.com>