From e4a567a9b0fe33fe0bab23d57c5deefbfbbe29bd Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Sat, 4 Apr 2015 18:27:44 +0600 Subject: Add support for Xen. Revamp the detection workflow. --- src/hypervisor_check.adb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/hypervisor_check.adb') diff --git a/src/hypervisor_check.adb b/src/hypervisor_check.adb index 9072b06..340d4a5 100644 --- a/src/hypervisor_check.adb +++ b/src/hypervisor_check.adb @@ -50,6 +50,21 @@ package body Hypervisor_Check is exception when others => return US.To_Unbounded_String (""); end Head_Of_File; + + -- Xen support hardware and paravirtual modes, in paravirtual mode + -- it's not detectable with CPUID + function Xen_Present return Boolean is + begin + if Config.Linux then + if Contains(Head_Of_File(Linux_Sys_HV_Type_File), "xen") then + return True; + else + return False; + end if; + else + raise OS_Not_Supported; + end if; + end Xen_Present; -- Hypervisors should set the bit 31 of %ecx to 1 in CPUID leaf 1 function Hypervisor_Present return Boolean is @@ -139,4 +154,14 @@ package body Hypervisor_Check is return Vendor_Name; end Get_DMI_Vendor_Name; + function Known_DMI_HV_Vendor (Name : US.Unbounded_String) return Boolean is + use US; + begin + if Name /= US.To_Unbounded_String("") then + return True; + else + return False; + end if; + end Known_DMI_HV_Vendor; + end Hypervisor_Check; -- cgit v1.2.3