diff options
author | Alexander Graf <agraf@suse.de> | 2014-07-13 16:45:46 +0200 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2014-09-08 12:50:51 +0200 |
commit | d696760b43ca46c070f74fe12d90f38904232467 (patch) | |
tree | 0747c27b81ec96c26cd377612908cb393e55ab3f /hw/misc | |
parent | 6fd33a750214a866772dd77573cfa24c27ad956d (diff) |
PPC: mac99: Fix core99 timer frequency
There is a special timer in the mac99 machine that we recently started
to emulate. Unfortunately we emulated it in the wrong frequency.
This patch adapts the frequency Mac OS X uses to evaluate results from
this timer, making calculations it bases off of it work.
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'hw/misc')
-rw-r--r-- | hw/misc/macio/macio.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c index 47f45f5d2c..35eaa00dce 100644 --- a/hw/misc/macio/macio.c +++ b/hw/misc/macio/macio.c @@ -243,13 +243,18 @@ static void timer_write(void *opaque, hwaddr addr, uint64_t value, static uint64_t timer_read(void *opaque, hwaddr addr, unsigned size) { uint32_t value = 0; + uint64_t systime = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); + uint64_t kltime; + + kltime = muldiv64(systime, 4194300, get_ticks_per_sec() * 4); + kltime = muldiv64(kltime, 18432000, 1048575); switch (addr) { case 0x38: - value = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); + value = kltime; break; case 0x3c: - value = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) >> 32; + value = kltime >> 32; break; } |