From 19e0cbb82ffab7220cdbcc78ab2c1dac823ce4e3 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Tue, 16 Jul 2013 06:45:57 -0700 Subject: target-alpha: Move alarm to vm_clock Basing the alarm off the rtc_clock was silly. It leads to horrible spinning in the guest after being suspended and resumed, as it tries to catch up with lost ticks. This requires adding an accessor for reading the vm_clock too. Signed-off-by: Richard Henderson --- target-alpha/helper.h | 3 ++- target-alpha/sys_helper.c | 7 ++++++- target-alpha/translate.c | 12 ++++++++---- 3 files changed, 16 insertions(+), 6 deletions(-) (limited to 'target-alpha') diff --git a/target-alpha/helper.h b/target-alpha/helper.h index 3321fde916..0e425cfc08 100644 --- a/target-alpha/helper.h +++ b/target-alpha/helper.h @@ -114,7 +114,8 @@ DEF_HELPER_FLAGS_2(tbis, TCG_CALL_NO_RWG, void, env, i64) DEF_HELPER_1(halt, void, i64); -DEF_HELPER_FLAGS_0(get_time, TCG_CALL_NO_RWG, i64) +DEF_HELPER_FLAGS_0(get_vmtime, TCG_CALL_NO_RWG, i64) +DEF_HELPER_FLAGS_0(get_walltime, TCG_CALL_NO_RWG, i64) DEF_HELPER_FLAGS_2(set_alarm, TCG_CALL_NO_RWG, void, env, i64) #endif diff --git a/target-alpha/sys_helper.c b/target-alpha/sys_helper.c index 339501af90..bd94597d36 100644 --- a/target-alpha/sys_helper.c +++ b/target-alpha/sys_helper.c @@ -70,7 +70,12 @@ void helper_halt(uint64_t restart) } } -uint64_t helper_get_time(void) +uint64_t helper_get_vmtime(void) +{ + return qemu_get_clock_ns(vm_clock); +} + +uint64_t helper_get_walltime(void) { return qemu_get_clock_ns(rtc_clock); } diff --git a/target-alpha/translate.c b/target-alpha/translate.c index dd7f0fbf94..5558b728dd 100644 --- a/target-alpha/translate.c +++ b/target-alpha/translate.c @@ -1634,15 +1634,19 @@ static ExitStatus gen_mfpr(int ra, int regno) return NO_EXIT; } - if (regno == 250) { - /* WALL_TIME */ + /* Special help for VMTIME and WALLTIME. */ + if (regno == 250 || regno == 249) { + void (*helper)(TCGv) = gen_helper_get_walltime; + if (regno == 249) { + helper = gen_helper_get_vmtime; + } if (use_icount) { gen_io_start(); - gen_helper_get_time(cpu_ir[ra]); + helper(cpu_ir[ra]); gen_io_end(); return EXIT_PC_STALE; } else { - gen_helper_get_time(cpu_ir[ra]); + helper(cpu_ir[ra]); return NO_EXIT; } } -- cgit v1.2.3