From f4b1a842d71ced24fb6b9145b9d1eadc48d64291 Mon Sep 17 00:00:00 2001 From: blueswir1 Date: Fri, 3 Oct 2008 19:04:42 +0000 Subject: [PATCH] Rearrange tick functions git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5408 c046a42c-6fe2-441c-8c8c-71466251a162 --- hw/sun4u.c | 15 +++++++++++++++ target-sparc/cpu.h | 7 +++++++ target-sparc/helper.c | 31 ------------------------------- target-sparc/op_helper.c | 24 ++++++++++++++++++++++++ 4 files changed, 46 insertions(+), 31 deletions(-) diff --git a/hw/sun4u.c b/hw/sun4u.c index 0c0091beb0..432e5d8b09 100644 --- a/hw/sun4u.c +++ b/hw/sun4u.c @@ -309,6 +309,21 @@ static void hstick_irq(void *opaque) cpu_interrupt(env, CPU_INTERRUPT_TIMER); } +void cpu_tick_set_count(void *opaque, uint64_t count) +{ + ptimer_set_count(opaque, -count); +} + +uint64_t cpu_tick_get_count(void *opaque) +{ + return -ptimer_get_count(opaque); +} + +void cpu_tick_set_limit(void *opaque, uint64_t limit) +{ + ptimer_set_limit(opaque, -limit, 0); +} + static const int ide_iobase[2] = { 0x1f0, 0x170 }; static const int ide_iobase2[2] = { 0x3f6, 0x376 }; static const int ide_irq[2] = { 14, 15 }; diff --git a/target-sparc/cpu.h b/target-sparc/cpu.h index 33aed2d888..baa7cc3559 100644 --- a/target-sparc/cpu.h +++ b/target-sparc/cpu.h @@ -501,4 +501,11 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp) /* sum4m.c, sun4u.c */ void cpu_check_irqs(CPUSPARCState *env); +#ifdef TARGET_SPARC64 +/* sun4u.c */ +void cpu_tick_set_count(void *opaque, uint64_t count); +uint64_t cpu_tick_get_count(void *opaque); +void cpu_tick_set_limit(void *opaque, uint64_t limit); +#endif + #endif diff --git a/target-sparc/helper.c b/target-sparc/helper.c index 12070b9246..6aca8fdcce 100644 --- a/target-sparc/helper.c +++ b/target-sparc/helper.c @@ -1412,34 +1412,3 @@ void cpu_dump_state(CPUState *env, FILE *f, #endif cpu_fprintf(f, "fsr: 0x%08x\n", env->fsr); } - -#ifdef TARGET_SPARC64 -#if !defined(CONFIG_USER_ONLY) -#include "qemu-common.h" -#include "hw/irq.h" -#include "qemu-timer.h" -#endif - -void helper_tick_set_count(void *opaque, uint64_t count) -{ -#if !defined(CONFIG_USER_ONLY) - ptimer_set_count(opaque, -count); -#endif -} - -uint64_t helper_tick_get_count(void *opaque) -{ -#if !defined(CONFIG_USER_ONLY) - return -ptimer_get_count(opaque); -#else - return 0; -#endif -} - -void helper_tick_set_limit(void *opaque, uint64_t limit) -{ -#if !defined(CONFIG_USER_ONLY) - ptimer_set_limit(opaque, -limit, 0); -#endif -} -#endif diff --git a/target-sparc/op_helper.c b/target-sparc/op_helper.c index 15a77ef078..6ab7098411 100644 --- a/target-sparc/op_helper.c +++ b/target-sparc/op_helper.c @@ -3086,3 +3086,27 @@ void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec, } #endif +#ifdef TARGET_SPARC64 +void helper_tick_set_count(void *opaque, uint64_t count) +{ +#if !defined(CONFIG_USER_ONLY) + cpu_tick_set_count(opaque, count); +#endif +} + +uint64_t helper_tick_get_count(void *opaque) +{ +#if !defined(CONFIG_USER_ONLY) + return cpu_tick_get_count(opaque); +#else + return 0; +#endif +} + +void helper_tick_set_limit(void *opaque, uint64_t limit) +{ +#if !defined(CONFIG_USER_ONLY) + cpu_tick_set_limit(opaque, limit); +#endif +} +#endif