On 08/24/2010 04:47 PM, Jason Wang wrote:
CR8 is only availabe when in long mode.
Signed-off-by: Jason Wang<[email protected]>
---
x86/vmexit.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/x86/vmexit.c b/x86/vmexit.c
index 819c24b..34b0af4 100644
--- a/x86/vmexit.c
+++ b/x86/vmexit.c
@@ -48,6 +48,7 @@ static void vmcall(void)
#define MSR_EFER 0xc0000080
#define EFER_NX_MASK (1ull<< 11)
+#define EFER_LMA_MASK (1ull<< 10)
static void mov_from_cr8(void)
{
@@ -68,6 +69,15 @@ static int is_smp(void)
return cpu_count()> 1;
}
+static int is_long_mode(void)
+{
+#ifdef __i386__
+ return 0;
+#else
+ return rdmsr(MSR_EFER) | EFER_LMA_MASK;
+#endif
+}
+
static void nop(void *junk)
{
}
@@ -100,8 +110,8 @@ static struct test {
} tests[] = {
{ cpuid_test, "cpuid", .parallel = 1, },
{ vmcall, "vmcall", .parallel = 1, },
- { mov_from_cr8, "mov_from_cr8", .parallel = 1, },
- { mov_to_cr8, "mov_to_cr8" , .parallel = 1, },
+ { mov_from_cr8, "mov_from_cr8", is_long_mode, .parallel = 1, },
+ { mov_to_cr8, "mov_to_cr8" , is_long_mode, .parallel = 1, },
{ inl_pmtimer, "inl_from_pmtimer", .parallel = 1, },
{ ipi, "ipi", is_smp, .parallel = 0, },
{ ipi_halt, "ipi+halt", is_smp, .parallel = 0, },
Enough to #ifdef __x86_64__. If it's defined we're in long mode.
--
error compiling committee.c: too many arguments to function
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html