On 14/08/2017 18:13, Jim Mattson wrote:
I noticed this too, but I thought it was mitigated by being underctxt->ops->get_msr(ctxt, MSR_EFER, &efer);What if leaf 0x80000008 is not defined?
- if (efer & EFER_LMA)
- rsvd = CR3_L_MODE_RESERVED_BITS & ~CR3_PCID_INVD;
+ if (efer & EFER_LMA) {
+ u64 maxphyaddr;
+ u32 eax = 0x80000008;
+
+ ctxt->ops->get_cpuid(ctxt, &eax, NULL, NULL, NULL);
+ maxphyaddr = eax * 0xff;
EFER_LMA. Unfortunately, kvm_set_efer doesn't check
guest_cpuid_has_longmode, so I guess you do have to test leaf 0x80000000
first. Alternatively:
1) kvm_cpuid could return false if it's falling back to
check_cpuid_limit, and emulator_get_cpuid can then be changed to return bool
2) kvm_cpuid and emulator_get_cpuid could gain a new argument to disable
the check_cpuid_limit fallback.
Yu, would you like to implement the latter?
Paolo