inmates cannot use X86_FEATURE_VMX from regular cpuid
as vcpu maks the bit explicitely on non-root cells.

use cpuid leaf 0 to detect AuthenticAMD and change to VMMCALL

Signed-off-by: Francois-Frederic Ozog <f...@ozog.com>
---
 inmates/lib/x86/hypercall.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/inmates/lib/x86/hypercall.c b/inmates/lib/x86/hypercall.c
index ac99f0c3..2d7a96e1 100644
--- a/inmates/lib/x86/hypercall.c
+++ b/inmates/lib/x86/hypercall.c
@@ -40,19 +40,19 @@

 #define X86_FEATURE_VMX        (1 << 5)

-bool jailhouse_use_vmcall;
+bool jailhouse_use_vmcall = true;

 void hypercall_init(void)
 {
-       u32 eax = 1, ecx = 0;
+       u32 eax = 0, ebx = 0, ecx = 0, edx = 0;

        asm volatile(
                "cpuid"
                : "=c" (ecx)
-               : "a" (eax), "c" (ecx)
-               : "rbx", "rdx", "memory"
+               : "a" (eax), "b" (ebx), "c" (ecx), "d" (edx)
+               : "memory"
        );

-       if (ecx & X86_FEATURE_VMX)
-               jailhouse_use_vmcall = true;
+       if (ebx == 0x68747541 && ecx == 0x444d4163 && edx == 0x69746E65)
+               jailhouse_use_vmcall = false;
 }
--
2.11.0

--
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jailhouse-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to