diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/hvinfo.adb | 2 | ||||
-rw-r--r-- | src/hypervisor_check.adb | 18 | ||||
-rw-r--r-- | src/hypervisor_check.ads | 2 |
3 files changed, 22 insertions, 0 deletions
diff --git a/src/hvinfo.adb b/src/hvinfo.adb index e9729a5..e15c75d 100644 --- a/src/hvinfo.adb +++ b/src/hvinfo.adb @@ -73,6 +73,8 @@ begin IO.Put_Line(IO.Standard_Error, "No hypervisor detected"); CL.Set_Exit_Status (1); end if; + elsif VirtualBox_PCI_Present then + IO.Put_Line (VirtualBox); end if; end if; diff --git a/src/hypervisor_check.adb b/src/hypervisor_check.adb index 30bccf3..df8391b 100644 --- a/src/hypervisor_check.adb +++ b/src/hypervisor_check.adb @@ -191,4 +191,22 @@ package body Hypervisor_Check is end if; end Known_DMI_HV_Vendor; + function VirtualBox_PCI_Present return Boolean is + begin + if Config.FreeBSD then + if Command_Succeeds ("/sbin/sysctl dev.vgapci | grep vendor=0x80ee") then + return True; + else + return False; + end if; + elsif Config.Linux then + -- Can be done, but on Linux VirtualBox is covered by DMI checks, + -- so I cut the corners here + -- XXX: maybe it's relevant on some UEFI machines + return False; + else + return False; + end if; + end; + end Hypervisor_Check; diff --git a/src/hypervisor_check.ads b/src/hypervisor_check.ads index f4b1eef..3941f8f 100644 --- a/src/hypervisor_check.ads +++ b/src/hypervisor_check.ads @@ -30,6 +30,8 @@ package Hypervisor_Check is function Command_Succeeds (Command : Interfaces.C.Char_Array) return Boolean; + function VirtualBox_PCI_Present return Boolean; + -- Vendor names for human consumption VMWare : constant String := "VMWare"; Xen_HVM : constant String := "Xen HVM"; |