aboutsummaryrefslogtreecommitdiff
path: root/target-alpha/op_helper.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2011-04-28 10:40:08 -0700
committerRichard Henderson <rth@twiddle.net>2011-10-08 08:49:09 -0700
commitc781cf96e298b9134b05ed1e7ca981a929e08e77 (patch)
tree5820b562c7b9eab3a3f71dc640502a09b028d632 /target-alpha/op_helper.c
parent034ebc2753e7d16879a91e4407c4e0706f63604e (diff)
target-alpha: Add high-resolution access to wall clock and an alarm.
The alarm is a fully general one-shot time comparator, which will be usable under Linux as a hrtimer source. It's much more flexible than the RTC source available on real hardware. The wall clock allows the guest access to the host timekeeping. Much like the KVM wall clock source for other guests. Both are accessed via the PALcode Cserve entry point. Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'target-alpha/op_helper.c')
-rw-r--r--target-alpha/op_helper.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/target-alpha/op_helper.c b/target-alpha/op_helper.c
index 1896ab8b00..cc102dbd63 100644
--- a/target-alpha/op_helper.c
+++ b/target-alpha/op_helper.c
@@ -1228,6 +1228,21 @@ void helper_halt(uint64_t restart)
qemu_system_shutdown_request();
}
}
+
+uint64_t helper_get_time(void)
+{
+ return qemu_get_clock_ns(rtc_clock);
+}
+
+void helper_set_alarm(uint64_t expire)
+{
+ if (expire) {
+ env->alarm_expire = expire;
+ qemu_mod_timer(env->alarm_timer, expire);
+ } else {
+ qemu_del_timer(env->alarm_timer);
+ }
+}
#endif
/*****************************************************************************/