kernel: Add more detailed VM detection.
authorSascha Wildner <saw@online.de>
Tue, 4 Mar 2014 18:07:21 +0000 (19:07 +0100)
committerSascha Wildner <saw@online.de>
Tue, 4 Mar 2014 22:11:41 +0000 (23:11 +0100)
commit5a1223c17c5bf9ecbba67f80b4c43b6ff0bb000a
treefe798128a5c9fe157e99166703644467efb5ce17
parent9a705213bbef413ba20f6c22b142b055805d1eb5
kernel: Add more detailed VM detection.

Previously, the kernel global 'vmm_guest' was either 0 or 1 depending
on the VMM bit in the CPU features (which isn't set in all VMs).

This commit adds more detailed information by checking the emulated
BIOS for known strings. The detected VMs include vkernel, which
doesn't strictly fit into the category, but it shares enough
similarities for this to be useful.

Also expose this information in a read-only sysctl (kern.vmm_guest).

The detection code was kind of adapted from FreeBSD (although their
kern.vm_guest works differently).

Tested-by: tuxillo
sys/kern/subr_param.c
sys/platform/pc32/i386/initcpu.c
sys/platform/pc64/x86_64/initcpu.c
sys/platform/vkernel/platform/init.c
sys/platform/vkernel64/platform/init.c
sys/sys/kernel.h
sys/sys/systm.h