+
+ if (timers_state.cpu_ticks_prev > ticks) {
+ /* Note: non increasing ticks may happen if the host uses
+ software suspend */
+ timers_state.cpu_ticks_offset += timers_state.cpu_ticks_prev - ticks;
+ ticks = timers_state.cpu_ticks_prev;
+ }
+
+ timers_state.cpu_ticks_prev = ticks;
+ return ticks;
+}
+
+static int64_t cpu_get_clock_locked(void)
+{
+ int64_t ticks;
+
+ ticks = timers_state.cpu_clock_offset;
+ if (timers_state.cpu_ticks_enabled) {
+ ticks += get_clock();
+ }
+
+ return ticks;