mirror of
https://github.com/rancher/os.git
synced 2025-09-01 23:04:41 +00:00
Make it work consistently for kvm too
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
This commit is contained in:
10
vendor/github.com/SvenDowideit/cpuid/cpuid.go
generated
vendored
10
vendor/github.com/SvenDowideit/cpuid/cpuid.go
generated
vendored
@@ -567,7 +567,8 @@ func isHypervisorActive() bool {
|
||||
func getHypervisorCpuid(ax uint32) string {
|
||||
a, b, c, d := cpuid(ax)
|
||||
var info [4]uint32 = [4]uint32{a, b, c, d}
|
||||
return strings.TrimRight(string((*[12]byte)(unsafe.Pointer(&info[1]))[:]), "\000")
|
||||
name := strings.TrimRight(string((*[12]byte)(unsafe.Pointer(&info[1]))[:]), "\000")
|
||||
return name
|
||||
}
|
||||
|
||||
// see https://people.redhat.com/~rjones/virt-what/ for how full coverage is done
|
||||
@@ -578,9 +579,10 @@ func hypervisorName() string {
|
||||
}
|
||||
// KVM has been caught to move its real signature to this leaf, and put something completely different in the
|
||||
// standard location. So this leaf must be checked first.
|
||||
if hv := getHypervisorCpuid(0x40000100); hv != "" {
|
||||
return hv
|
||||
}
|
||||
// Sven removed it - in one test system, this leaf returns garbage :(
|
||||
//if hv := getHypervisorCpuid(0x40000100); hv != "" {
|
||||
// return hv
|
||||
//}
|
||||
|
||||
if hv := getHypervisorCpuid(0x40000000); hv != "" {
|
||||
return hv
|
||||
|
Reference in New Issue
Block a user