diff options
Diffstat (limited to 'replay')
-rwxr-xr-x | replay/replay-char.c | 8 | ||||
-rw-r--r-- | replay/replay-snapshot.c | 17 | ||||
-rw-r--r-- | replay/replay.c | 5 |
3 files changed, 26 insertions, 4 deletions
diff --git a/replay/replay-char.c b/replay/replay-char.c index edf46ab9df..aa65955942 100755 --- a/replay/replay-char.c +++ b/replay/replay-char.c @@ -18,7 +18,7 @@ /* Char drivers that generate qemu_chr_be_write events that should be saved into the log. */ -static CharDriverState **char_drivers; +static Chardev **char_drivers; static int drivers_count; /* Char event attributes. */ @@ -28,7 +28,7 @@ typedef struct CharEvent { size_t len; } CharEvent; -static int find_char_driver(CharDriverState *chr) +static int find_char_driver(Chardev *chr) { int i = 0; for ( ; i < drivers_count ; ++i) { @@ -39,7 +39,7 @@ static int find_char_driver(CharDriverState *chr) return -1; } -void replay_register_char_driver(CharDriverState *chr) +void replay_register_char_driver(Chardev *chr) { if (replay_mode == REPLAY_MODE_NONE) { return; @@ -49,7 +49,7 @@ void replay_register_char_driver(CharDriverState *chr) char_drivers[drivers_count++] = chr; } -void replay_chr_be_write(CharDriverState *s, uint8_t *buf, int len) +void replay_chr_be_write(Chardev *s, uint8_t *buf, int len) { CharEvent *event = g_malloc0(sizeof(CharEvent)); diff --git a/replay/replay-snapshot.c b/replay/replay-snapshot.c index 498059734d..65e2d375c2 100644 --- a/replay/replay-snapshot.c +++ b/replay/replay-snapshot.c @@ -59,3 +59,20 @@ void replay_vmstate_register(void) { vmstate_register(NULL, 0, &vmstate_replay, &replay_state); } + +void replay_vmstate_init(void) +{ + if (replay_snapshot) { + if (replay_mode == REPLAY_MODE_RECORD) { + if (save_vmstate(cur_mon, replay_snapshot) != 0) { + error_report("Could not create snapshot for icount record"); + exit(1); + } + } else if (replay_mode == REPLAY_MODE_PLAY) { + if (load_vmstate(replay_snapshot) != 0) { + error_report("Could not load snapshot for icount replay"); + exit(1); + } + } + } +} diff --git a/replay/replay.c b/replay/replay.c index 7f27cf17b0..1835b9902e 100644 --- a/replay/replay.c +++ b/replay/replay.c @@ -26,6 +26,7 @@ #define HEADER_SIZE (sizeof(uint32_t) + sizeof(uint64_t)) ReplayMode replay_mode = REPLAY_MODE_NONE; +char *replay_snapshot; /* Name of replay file */ static char *replay_filename; @@ -292,6 +293,7 @@ void replay_configure(QemuOpts *opts) exit(1); } + replay_snapshot = g_strdup(qemu_opt_get(opts, "rrsnapshot")); replay_vmstate_register(); replay_enable(fname, mode); @@ -346,6 +348,9 @@ void replay_finish(void) replay_filename = NULL; } + g_free(replay_snapshot); + replay_snapshot = NULL; + replay_finish_events(); replay_mutex_destroy(); } |