aboutsummaryrefslogtreecommitdiff
path: root/util/qemu-timer-common.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2021-01-08 22:42:54 +0000
committerAlex Bennée <alex.bennee@linaro.org>2021-01-18 10:05:06 +0000
commit4d834039c2107cb86931cb3f22ca3de6e4e42b06 (patch)
tree2c278742939745f9a9c84aeb0253f12867a7634e /util/qemu-timer-common.c
parent6b80cb25b4165ae2afa525d084366221a2e9b58d (diff)
semihosting: Implement SYS_ELAPSED and SYS_TICKFREQ
These are part of Semihosting for AArch32 and AArch64 Release 2.0 Signed-off-by: Keith Packard <keithp@keithp.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20210107170717.2098982-8-keithp@keithp.com> Message-Id: <20210108224256.2321-19-alex.bennee@linaro.org>
Diffstat (limited to 'util/qemu-timer-common.c')
-rw-r--r--util/qemu-timer-common.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/util/qemu-timer-common.c b/util/qemu-timer-common.c
index baf3317f74..cc1326f726 100644
--- a/util/qemu-timer-common.c
+++ b/util/qemu-timer-common.c
@@ -27,6 +27,8 @@
/***********************************************************/
/* real time host monotonic timer */
+int64_t clock_start;
+
#ifdef _WIN32
int64_t clock_freq;
@@ -41,6 +43,7 @@ static void __attribute__((constructor)) init_get_clock(void)
exit(1);
}
clock_freq = freq.QuadPart;
+ clock_start = get_clock();
}
#else
@@ -55,5 +58,6 @@ static void __attribute__((constructor)) init_get_clock(void)
if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
use_rt_clock = 1;
}
+ clock_start = get_clock();
}
#endif