From a74c34024a66572acd91f4b51c61df22549e1b55 Mon Sep 17 00:00:00 2001 From: Andrew Zaborowski Date: Sun, 14 May 2017 04:40:22 +0200 Subject: [PATCH] test-runner: Check for SVM in check_virtualization Update check_virtualization to check for the SVM on x86, KVM supports both VMX and SVM. Fix the clobber list of the VMX check: memory is not clobbered while ebx and edx are (ecx is already marked as output). I'm not able to test this patch on a cpu that would be affected by it but I don't think test-runner has been tested on those cpus yet. --- tools/test-runner.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/test-runner.c b/tools/test-runner.c index 6ccf6751..b90c638b 100644 --- a/tools/test-runner.c +++ b/tools/test-runner.c @@ -245,12 +245,21 @@ static bool check_virtualization(void) #if defined(__GNUC__) && (defined(__i386__) || defined(__amd64__)) uint32_t ecx; - __asm__ __volatile__("cpuid" : "=c" (ecx) : "a" (1) : "memory"); + __asm__ __volatile__("cpuid" : "=c" (ecx) : + "a" (1) : "%ebx", "%edx"); if (!!(ecx & (1 << 5))) { l_info("Found support for Virtual Machine eXtensions"); return true; } + + __asm__ __volatile__("cpuid" : "=c" (ecx) : + "a" (0x80000001) : "%ebx", "%edx"); + + if (ecx & (1 << 2)) { + l_info("Found support for Secure Virtual Machine extension"); + return true; + } #endif return false; }