From: Andrew Cooper Date: Wed, 11 May 2016 12:38:14 +0000 (+0100) Subject: Provide function pointer abstractions for cpuid() and cpuid_count() X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=3a12df20d3ce2d78a0820c60efd265c9dc879a4d;p=people%2Froyger%2Fxen-test-framework.git Provide function pointer abstractions for cpuid() and cpuid_count() 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 --- diff --git a/include/arch/x86/cpuid.h b/include/arch/x86/cpuid.h new file mode 100644 index 0000000..ea9d024 --- /dev/null +++ b/include/arch/x86/cpuid.h @@ -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: + */ diff --git a/include/arch/x86/xtf.h b/include/arch/x86/xtf.h index eb7f9dd..ab0bf69 100644 --- a/include/arch/x86/xtf.h +++ b/include/arch/x86/xtf.h @@ -1,6 +1,7 @@ #ifndef XTF_X86_XTF_H #define XTF_X86_XTF_H +#include #include #endif /* XTF_X86_XTF_H */ diff --git a/tests/cpuid/main.c b/tests/cpuid/main.c index adb5bc1..bdb9a23 100644 --- a/tests/cpuid/main.c +++ b/tests/cpuid/main.c @@ -11,11 +11,7 @@ */ #include -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;