[kvm-unit-tests PATCH 3/5] powerpc: check 64bit mode

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

 



Check in MSR if the SF bit is set (64bit mode is enabled)

Signed-off-by: Laurent Vivier <lvivier@xxxxxxxxxx>
---
 powerpc/emulator.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/powerpc/emulator.c b/powerpc/emulator.c
index 1215c4f..b66c1d7 100644
--- a/powerpc/emulator.c
+++ b/powerpc/emulator.c
@@ -32,12 +32,26 @@ static void test_illegal(void)
 	report_prefix_pop();
 }
 
+static void test_64bit(void)
+{
+	uint64_t msr;
+
+	report_prefix_push("64bit");
+
+	asm("mfmsr %[msr]": [msr] "=r" (msr));
+
+	report("detected", msr & 0x8000000000000000UL);
+
+	report_prefix_pop();
+}
+
 int main(void)
 {
 	handle_exception(0x700, program_check_handler, (void *)&is_invalid);
 
 	report_prefix_push("emulator");
 
+	test_64bit();
 	test_illegal();
 
 	report_prefix_pop();
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux