summaryrefslogtreecommitdiff
path: root/src/hypervisor_check.adb
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2015-04-04 18:27:44 +0600
committerDaniil Baturin <daniil@baturin.org>2015-04-04 18:27:44 +0600
commite4a567a9b0fe33fe0bab23d57c5deefbfbbe29bd (patch)
tree2514a8ea955748edfd0db68052b99fd6d00f4bac /src/hypervisor_check.adb
parent906da6a7baedc302674b59ce70bfe50b44a834df (diff)
downloadhvinfo-e4a567a9b0fe33fe0bab23d57c5deefbfbbe29bd.tar.gz
hvinfo-e4a567a9b0fe33fe0bab23d57c5deefbfbbe29bd.zip
Add support for Xen. Revamp the detection workflow.
Diffstat (limited to 'src/hypervisor_check.adb')
-rw-r--r--src/hypervisor_check.adb25
1 files changed, 25 insertions, 0 deletions
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;