3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-21 22:09:23 +01:00

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.
This commit is contained in:
Andrew Zaborowski 2017-05-14 04:40:22 +02:00 committed by Denis Kenzior
parent 920e79b32c
commit a74c34024a

View File

@ -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;
}