diff options
Diffstat (limited to 'target-ppc/kvm.c')
-rw-r--r-- | target-ppc/kvm.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c index 313c7b2af2..a090d79ad4 100644 --- a/target-ppc/kvm.c +++ b/target-ppc/kvm.c @@ -888,14 +888,35 @@ static inline uint32_t mfpvr(void) return pvr; } +static void alter_insns(uint64_t *word, uint64_t flags, bool on) +{ + if (on) { + *word |= flags; + } else { + *word &= ~flags; + } +} + const ppc_def_t *kvmppc_host_cpu_def(void) { uint32_t host_pvr = mfpvr(); const ppc_def_t *base_spec; + ppc_def_t *spec; + uint32_t vmx = kvmppc_get_vmx(); + uint32_t dfp = kvmppc_get_dfp(); base_spec = ppc_find_by_pvr(host_pvr); - return base_spec; + spec = g_malloc0(sizeof(*spec)); + memcpy(spec, base_spec, sizeof(*spec)); + + /* Now fix up the spec with information we can query from the host */ + + alter_insns(&spec->insns_flags, PPC_ALTIVEC, vmx > 0); + alter_insns(&spec->insns_flags2, PPC2_VSX, vmx > 1); + alter_insns(&spec->insns_flags2, PPC2_DFP, dfp); + + return spec; } bool kvm_arch_stop_on_emulation_error(CPUState *env) |