summaryrefslogtreecommitdiffstats
path: root/include/sysemu
diff options
context:
space:
mode:
Diffstat (limited to 'include/sysemu')
-rw-r--r--include/sysemu/replay.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/sysemu/replay.h b/include/sysemu/replay.h
index c2a7651..2398509 100644
--- a/include/sysemu/replay.h
+++ b/include/sysemu/replay.h
@@ -16,6 +16,16 @@
#include <stdint.h>
#include "qapi-types.h"
+/* replay clock kinds */
+enum ReplayClockKind {
+ /* host_clock */
+ REPLAY_CLOCK_HOST,
+ /* virtual_rt_clock */
+ REPLAY_CLOCK_VIRTUAL_RT,
+ REPLAY_CLOCK_COUNT
+};
+typedef enum ReplayClockKind ReplayClockKind;
+
extern ReplayMode replay_mode;
/* Processing the instructions */
@@ -43,6 +53,19 @@ bool replay_interrupt(void);
Returns true, when interrupt request is pending */
bool replay_has_interrupt(void);
+/* Processing clocks and other time sources */
+
+/*! Save the specified clock */
+int64_t replay_save_clock(ReplayClockKind kind, int64_t clock);
+/*! Read the specified clock from the log or return cached data */
+int64_t replay_read_clock(ReplayClockKind kind);
+/*! Saves or reads the clock depending on the current replay mode. */
+#define REPLAY_CLOCK(clock, value) \
+ (replay_mode == REPLAY_MODE_PLAY ? replay_read_clock((clock)) \
+ : replay_mode == REPLAY_MODE_RECORD \
+ ? replay_save_clock((clock), (value)) \
+ : (value))
+
/* Asynchronous events queue */
/*! Disables storing events in the queue */
OpenPOWER on IntegriCloud