]> xenbits.xensource.com Git - people/royger/xen-test-framework.git/commitdiff
Provide function pointer abstractions for cpuid() and cpuid_count()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 11 May 2016 12:38:14 +0000 (13:38 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 11 May 2016 12:38:14 +0000 (13:38 +0100)
Code common between PV and HVM using cpuid() needs to use different cpuid()
implementations, as PV guests need to use the Xen forced emulation prefix.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
include/arch/x86/cpuid.h [new file with mode: 0644]
include/arch/x86/xtf.h
tests/cpuid/main.c

diff --git a/include/arch/x86/cpuid.h b/include/arch/x86/cpuid.h
new file mode 100644 (file)
index 0000000..ea9d024
--- /dev/null
@@ -0,0 +1,21 @@
+#ifndef XTF_X86_CPUID_H
+#define XTF_X86_CPUID_H
+
+typedef void (*cpuid_fn_t)(uint32_t leaf,
+                           uint32_t *eax, uint32_t *ebx,
+                           uint32_t *ecx, uint32_t *edx);
+typedef void (*cpuid_count_fn_t)(uint32_t leaf, uint32_t subleaf,
+                                 uint32_t *eax, uint32_t *ebx,
+                                 uint32_t *ecx, uint32_t *edx);
+
+#endif /* XTF_X86_CPUID_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
index eb7f9dd3960a6e5397f735bbbff2b922f038d623..ab0bf69db9b5c119bd956a416fd2dd5d7d97ca14 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef XTF_X86_XTF_H
 #define XTF_X86_XTF_H
 
+#include <arch/x86/cpuid.h>
 #include <arch/x86/lib.h>
 
 #endif /* XTF_X86_XTF_H */
index adb5bc1c31862e61c7a9fa0cff1096de12336310..bdb9a2300e31f4d3b6e1110e6908fcb2fa41ee35 100644 (file)
  */
 #include <xtf.h>
 
-static void dump_leaves(
-    void (*cpuid_fn)(uint32_t leaf, uint32_t subleaf,
-                     uint32_t *eax, uint32_t *ebx,
-                     uint32_t *ecx, uint32_t *edx)
-    )
+static void dump_leaves(cpuid_count_fn_t cpuid_fn)
 {
     uint32_t leaf = 0, subleaf = ~0U;