aboutsummaryrefslogtreecommitdiff
path: root/replay/replay-snapshot.c
diff options
context:
space:
mode:
authorPavel Dovgalyuk <pavel.dovgaluk@ispras.ru>2017-01-24 10:17:47 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2017-01-27 18:07:30 +0100
commit9c2037d0a41d3d55b17a68e42e815be45036d8d2 (patch)
treef67f146cccc9f0c6f1a6ad271f770188238875eb /replay/replay-snapshot.c
parentac8c19ba742fcbc3d64a5390b32acc6479edd7e1 (diff)
downloadqemu-9c2037d0a41d3d55b17a68e42e815be45036d8d2.zip
qemu-9c2037d0a41d3d55b17a68e42e815be45036d8d2.tar.gz
qemu-9c2037d0a41d3d55b17a68e42e815be45036d8d2.tar.bz2
replay: save/load initial state
This patch implements initial vmstate creation or loading at the start of record/replay. It is needed for rewinding the execution in the replay mode. v4 changes: - snapshots are not created by default anymore v3 changes: - added rrsnapshot option Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru> Message-Id: <20170124071746.4572.61449.stgit@PASHA-ISP> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'replay/replay-snapshot.c')
-rw-r--r--replay/replay-snapshot.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/replay/replay-snapshot.c b/replay/replay-snapshot.c
index 4980597..65e2d37 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);
+ }
+ }
+ }
+}