path: root/qemu-timer.h
authorAlexander Graf <[email protected]>2010-04-03 09:37:26 (GMT)
committer malc <[email protected]>2010-04-03 10:26:45 (GMT)
commit4a9590f32e5692114aaae4ca10da89dac633e164 (patch) (side-by-side diff)
tree91f5bab144307c88d59785ca41f1a55efadd3cd0 /qemu-timer.h
parent93c5a32f89c19a97badd0aa79d2ac2e44376b40e (diff)
Make cpu_get_real_ticks use mfspr
PowerPC CPUs have had two ways to read the time base for quite some time now. They provide it using the mfspr instruction or - if a special bit is set in that opcode - using mftb. For timekeeping we're currently using mftb. While trying to get Qemu up and running on an e500v2 system, I stumbled over the CPU not supporting mftbu. It just throws an illegal instruction trap. So let's read the SPR values instead. All PPC CPUs should support them anyways. I tested this patch on an e500v2 system where it makes qemu work and on my 970MP system with 32-bit user space where everything still works with this patch applied. Signed-off-by: Alexander Graf <[email protected]> Signed-off-by: malc <[email protected]>
Diffstat (limited to 'qemu-timer.h') (more/less context) (ignore whitespace changes)
1 files changed, 3 insertions, 3 deletions
diff --git a/qemu-timer.h b/qemu-timer.h
index a7eac98..d2e15f4 100644
--- a/qemu-timer.h
+++ b/qemu-timer.h
@@ -98,9 +98,9 @@ static inline int64_t cpu_get_real_ticks(void)
/* */
unsigned long junk;
- __asm__ __volatile__ ("mftbu %1\n\t"
- "mftb %L0\n\t"
- "mftbu %0\n\t"
+ __asm__ __volatile__ ("mfspr %1,269\n\t" /* mftbu */
+ "mfspr %L0,268\n\t" /* mftb */
+ "mfspr %0,269\n\t" /* mftbu */
"cmpw %0,%1\n\t"
"bne $-16"
: "=r" (retval), "=r" (junk));