xemu/target/i386/hvf
Roman Bolshakov 5009ef22c6 i386: hvf: Don't duplicate register reset
hvf_reset_vcpu() duplicates actions performed by x86_cpu_reset(). The
difference is that hvf_reset_vcpu() stores initial values directly to
VMCS while x86_cpu_reset() stores it in CPUX86State and then
cpu_synchronize_all_post_init() or cpu_synchronize_all_post_reset()
flushes CPUX86State into VMCS. That makes hvf_reset_vcpu() a kind of
no-op.

Here's the trace of CPU state modifications during VM start:
  hvf_reset_vcpu (resets VMCS)
  cpu_synchronize_all_post_init (overwrites VMCS fields written by
                                 hvf_reset_vcpu())
  cpu_synchronize_all_states
  hvf_reset_vcpu (resets VMCS)
  cpu_synchronize_all_post_reset (overwrites VMCS fields written by
                                  hvf_reset_vcpu())

General purpose registers, system registers, segment descriptors, flags
and IP are set by hvf_put_segments() in post-init and post-reset,
therefore it's safe to remove them from hvf_reset_vcpu().

PDPTE initialization can be dropped because Intel SDM (26.3.1.6 Checks
on Guest Page-Directory-Pointer-Table Entries) doesn't require PDPTE to
be clear unless PAE is used: "A VM entry to a guest that does not use
PAE paging does not check the validity of any PDPTEs."
And if PAE is used, PDPTE's are initialized from CR3 in macvm_set_cr0().

Cc: Cameron Esfahani <dirty@apple.com>
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Message-Id: <20200630102824.77604-8-r.bolshakov@yadro.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-07-10 18:02:19 -04:00
..
hvf-i386.h i386: hvf: Move HVFState definition into hvf 2020-06-12 11:12:45 -04:00
hvf.c i386: hvf: Don't duplicate register reset 2020-07-10 18:02:19 -04:00
Makefile.objs i386: hvf: move all hvf files in the same directory 2017-12-22 15:02:05 +01:00
panic.h i386: hvf: cleanup x86_gen.h 2017-12-22 15:02:07 +01:00
README.md i386: Compile CPUX86State xsave_buf only when support KVM or HVF 2018-10-02 19:09:12 +02:00
vmcs.h Clean up ill-advised or unusual header guards 2019-05-13 08:58:55 +02:00
vmx.h i386: hvf: Move Guest LMA reset to macvm_set_cr0() 2020-07-10 18:02:19 -04:00
x86_cpuid.c target/i386: drop the duplicated definition of cpuid AVX512_VBMI macro 2019-10-15 18:34:44 -03:00
x86_decode.c i386: hvf: Drop copy of RFLAGS defines 2020-06-12 11:15:02 -04:00
x86_decode.h hvf: correctly handle REX prefix in relation to legacy prefixes 2019-11-26 09:58:36 +01:00
x86_descr.c i386: hvf: unify register enums between HVF and the rest 2017-12-22 15:02:07 +01:00
x86_descr.h Normalize header guard symbol definition. 2019-05-13 08:58:55 +02:00
x86_emu.c i386: hvf: Move mmio_buf into CPUX86State 2020-06-12 11:20:09 -04:00
x86_emu.h Clean up ill-advised or unusual header guards 2019-05-13 08:58:55 +02:00
x86_flags.c i386: hvf: Move lazy_flags into CPUX86State 2020-06-12 11:19:37 -04:00
x86_flags.h Clean up ill-advised or unusual header guards 2019-05-13 08:58:55 +02:00
x86_mmu.c Avoid address_space_rw() with a constant is_write argument 2020-02-20 14:47:08 +01:00
x86_mmu.h Clean up ill-advised or unusual header guards 2019-05-13 08:58:55 +02:00
x86_task.c i386: hvf: Drop copy of RFLAGS defines 2020-06-12 11:15:02 -04:00
x86_task.h Clean up header guards that don't match their file name 2019-05-13 08:58:55 +02:00
x86.c i386: hvf: Drop copy of RFLAGS defines 2020-06-12 11:15:02 -04:00
x86.h i386: hvf: Drop HVFX86EmulatorState 2020-06-12 11:20:12 -04:00
x86hvf.c i386: hvf: Drop rflags from HVFX86EmulatorState 2020-06-12 11:15:02 -04:00
x86hvf.h i386: hvf: move all hvf files in the same directory 2017-12-22 15:02:05 +01:00

OS X Hypervisor.framework support in QEMU

These sources (and ../hvf-all.c) are adapted from Veertu Inc's vdhh (Veertu Desktop Hosted Hypervisor) (last known location: https://github.com/veertuinc/vdhh) with some minor changes, the most significant of which were:

  1. Adapt to our current QEMU's CPUState structure and address_space_rw API; many struct members have been moved around (emulated x86 state, xsave_buf) due to historical differences + QEMU needing to handle more emulation targets.
  2. Removal of apic_page and hyperv-related functionality.
  3. More relaxed use of qemu_mutex_lock_iothread.