Reviewed-by: Cameron Esfahani <di...@apple.com> Cameron Esfahani di...@apple.com
"The cake is a lie." Common wisdom > On May 28, 2020, at 12:37 PM, Roman Bolshakov <r.bolsha...@yadro.com> wrote: > > Hi, > > This is a cleanup series for HVF accel. > > HVF is using two emulator states CPUX86State and HVFX86EmulatorState > simultaneously. HVFX86EmulatorState is used for instruction emulation. > CPUX86State is used in all other places. Sometimes the states are in > sync, sometimes they're not. It complicates reasoning about emulator > behaviour given that there's a third state - VMCS. > > The series tries to leverage CPUX86State for instruction decoding and > removes HVFX86EmulatorState. I had to add two new hvf-specific fields to > CPUX86State: lazy_flags and mmio_buf. It's likely that cc_op, cc_dst, > etc could be reused for lazy_flags but it'd require major rework of flag > processing during instruction emulation. Hopefully that'll happen too in > the future. > > I tried to include sysemu/hvf.h into target/i386/cpu.h to add definition > of hvf lazy flags but couldn't do that at first it because it introduced > circular dependency between existing sysemu/hvf.h and cpu.h. The first > three patches untangle and prune sysemu/hvf.h to the bare minimum to > allow inclusion of sysemu/hvf.h into target/i386/cpu.h. > > This might conflict with [1], but merge/rebase should be trivial. > > 1. https://lists.gnu.org/archive/html/qemu-devel/2020-05/msg07449.html > > Thanks, > Roman > > Roman Bolshakov (13): > i386: hvf: Move HVFState definition into hvf > i386: hvf: Drop useless declarations in sysemu > i386: hvf: Clean stray includes in sysemu > i386: hvf: Drop unused variable > i386: hvf: Use ins_len to advance IP > i386: hvf: Use IP from CPUX86State > i386: hvf: Drop fetch_rip from HVFX86EmulatorState > i386: hvf: Drop rflags from HVFX86EmulatorState > i386: hvf: Drop copy of RFLAGS defines > i386: hvf: Drop regs in HVFX86EmulatorState > i386: hvf: Move lazy_flags into CPUX86State > i386: hvf: Move mmio_buf into CPUX86State > i386: hvf: Drop HVFX86EmulatorState > > include/qemu/typedefs.h | 1 - > include/sysemu/hvf.h | 73 ++------------------- > target/i386/cpu.h | 4 +- > target/i386/hvf/hvf-i386.h | 35 ++++++++++ > target/i386/hvf/hvf.c | 30 ++++----- > target/i386/hvf/x86.c | 2 +- > target/i386/hvf/x86.h | 89 ++----------------------- > target/i386/hvf/x86_decode.c | 25 ++++--- > target/i386/hvf/x86_emu.c | 122 +++++++++++++++++------------------ > target/i386/hvf/x86_flags.c | 81 ++++++++++++----------- > target/i386/hvf/x86_task.c | 10 +-- > target/i386/hvf/x86hvf.c | 6 +- > 12 files changed, 186 insertions(+), 292 deletions(-) > > -- > 2.26.1 > >