From e3ea652962383a2ffc05b2f1b10a0e97542eb6f8 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Mon, 21 Dec 2009 12:24:17 +0100 Subject: PPC64: Fix timebase On PPC we have a 64-bit time base. Usually (PPC32) this is accessed using two separate 32 bit SPR accesses to SPR_TBU and SPR_TBL. On PPC64 the SPR_TBL register acts as 64 bit though, so we get the full 64 bits as return value. If we only take the lower ones, fine. But Linux wants to see all 64 bits or it breaks. This patch makes PPC64 Linux work even after TB crossed the 32-bit boundary, which usually happened a few seconds after bootup. Signed-off-by: Alexander Graf Signed-off-by: Aurelien Jarno --- hw/ppc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'hw') diff --git a/hw/ppc.c b/hw/ppc.c index 52080394fe..b4bf2d37a2 100644 --- a/hw/ppc.c +++ b/hw/ppc.c @@ -401,7 +401,7 @@ static inline uint64_t cpu_ppc_get_tb(ppc_tb_t *tb_env, uint64_t vmclk, return muldiv64(vmclk, tb_env->tb_freq, get_ticks_per_sec()) + tb_offset; } -uint32_t cpu_ppc_load_tbl (CPUState *env) +uint64_t cpu_ppc_load_tbl (CPUState *env) { ppc_tb_t *tb_env = env->tb_env; uint64_t tb; @@ -409,7 +409,7 @@ uint32_t cpu_ppc_load_tbl (CPUState *env) tb = cpu_ppc_get_tb(tb_env, qemu_get_clock(vm_clock), tb_env->tb_offset); LOG_TB("%s: tb %016" PRIx64 "\n", __func__, tb); - return tb & 0xFFFFFFFF; + return tb; } static inline uint32_t _cpu_ppc_load_tbu(CPUState *env) -- cgit v1.2.3