[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 2/7] cpu: Export few x86-specific APIs



---
 src/cpu/cpu_x86.c        | 21 ++++++++++++++++++---
 src/cpu/cpu_x86.h        | 10 ++++++++++
 src/libvirt_private.syms |  7 +++++++
 3 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 560a2a9..dbbcfd2 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -203,7 +203,7 @@ x86DataCpuid(const struct cpuX86Data *data,
 }
 
 
-static void
+void
 x86DataFree(struct cpuX86Data *data)
 {
     if (data == NULL)
@@ -215,7 +215,7 @@ x86DataFree(struct cpuX86Data *data)
 }
 
 
-static virCPUDataPtr
+virCPUDataPtr
 x86MakeCPUData(virArch arch, struct cpuX86Data **data)
 {
     virCPUDataPtr cpuData;
@@ -295,7 +295,7 @@ x86DataExpand(struct cpuX86Data *data,
 }
 
 
-static int
+int
 x86DataAddCpuid(struct cpuX86Data *data,
                 const struct cpuX86cpuid *cpuid)
 {
@@ -323,6 +323,21 @@ x86DataAddCpuid(struct cpuX86Data *data,
 }
 
 
+int
+x86DataSetVendor(struct cpuX86Data *data,
+                 const char *vendor)
+{
+    struct cpuX86cpuid cpuid;
+
+    cpuid.function = 0;
+    cpuid.ebx = virReadBufInt32LE(vendor);
+    cpuid.edx = virReadBufInt32LE(vendor + 4);
+    cpuid.ecx = virReadBufInt32LE(vendor + 8);
+
+    return x86DataAddCpuid(data, &cpuid);
+}
+
+
 static int
 x86DataAdd(struct cpuX86Data *data1,
            const struct cpuX86Data *data2)
diff --git a/src/cpu/cpu_x86.h b/src/cpu/cpu_x86.h
index 77965b7..8235076 100644
--- a/src/cpu/cpu_x86.h
+++ b/src/cpu/cpu_x86.h
@@ -25,7 +25,17 @@
 # define __VIR_CPU_X86_H__
 
 # include "cpu.h"
+# include "cpu_x86_data.h"
 
 extern struct cpuArchDriver cpuDriverX86;
 
+int x86DataAddCpuid(struct cpuX86Data *data,
+                    const struct cpuX86cpuid *cpuid);
+int x86DataSetVendor(struct cpuX86Data *data,
+                     const char *vendor);
+
+void x86DataFree(struct cpuX86Data *data);
+
+virCPUDataPtr x86MakeCPUData(virArch arch, struct cpuX86Data **data);
+
 #endif /* __VIR_CPU_X86_H__ */
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index e0f3876..7fe2bc0 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -724,6 +724,13 @@ cpuNodeData;
 cpuUpdate;
 
 
+# cpu/cpu_x86.h
+x86DataAddCpuid;
+x86DataFree;
+x86DataSetVendor;
+x86MakeCPUData;
+
+
 # datatypes.h
 virConnectClass;
 virDomainClass;
-- 
1.8.3.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]