From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58247) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YEDVP-0001qy-NN for qemu-devel@nongnu.org; Thu, 22 Jan 2015 03:52:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YEDVJ-0005TF-JM for qemu-devel@nongnu.org; Thu, 22 Jan 2015 03:52:47 -0500 Received: from mail.ispras.ru ([83.149.199.45]:36371) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YEDVJ-0005T6-5E for qemu-devel@nongnu.org; Thu, 22 Jan 2015 03:52:41 -0500 From: Pavel Dovgalyuk Date: Thu, 22 Jan 2015 11:52:43 +0300 Message-ID: <20150122085243.5276.21941.stgit@PASHA-ISP.def.inno> In-Reply-To: <20150122085127.5276.53895.stgit@PASHA-ISP.def.inno> References: <20150122085127.5276.53895.stgit@PASHA-ISP.def.inno> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [RFC PATCH v8 13/21] replay: shutdown event List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, alex.bennee@linaro.org, mark.burton@greensocs.com, real@ispras.ru, batuzovk@ispras.ru, maria.klimushenkova@ispras.ru, pavel.dovgaluk@ispras.ru, pbonzini@redhat.com, afaerber@suse.de, fred.konrad@greensocs.com This patch records and replays simulator shutdown event. Signed-off-by: Pavel Dovgalyuk --- replay/replay-internal.h | 2 ++ replay/replay.c | 12 ++++++++++++ replay/replay.h | 5 +++++ vl.c | 1 + 4 files changed, 20 insertions(+), 0 deletions(-) diff --git a/replay/replay-internal.h b/replay/replay-internal.h index be71e6f..68b2d45 100755 --- a/replay/replay-internal.h +++ b/replay/replay-internal.h @@ -27,6 +27,8 @@ enum ReplayEvents { EVENT_TIME_T, /* for tm event */ EVENT_TM, + /* for shutdown request */ + EVENT_SHUTDOWN, /* for clock read/writes */ /* some of grteater codes are reserved for clocks */ EVENT_CLOCK diff --git a/replay/replay.c b/replay/replay.c index 307ac4b..cfa69fa 100755 --- a/replay/replay.c +++ b/replay/replay.c @@ -13,6 +13,7 @@ #include "replay.h" #include "replay-internal.h" #include "qemu/timer.h" +#include "sysemu/sysemu.h" ReplayMode replay_mode = REPLAY_MODE_NONE; @@ -34,6 +35,10 @@ bool skip_async_events(int stop_event) res = true; } switch (replay_data_kind) { + case EVENT_SHUTDOWN: + replay_has_unread_data = 0; + qemu_system_shutdown_request(); + break; case EVENT_INSTRUCTION: replay_state.instructions_count = replay_get_dword(); return res; @@ -151,3 +156,10 @@ bool replay_has_interrupt(void) } return res; } + +void replay_shutdown_request(void) +{ + if (replay_mode == REPLAY_MODE_RECORD) { + replay_put_event(EVENT_SHUTDOWN); + } +} diff --git a/replay/replay.h b/replay/replay.h index 2f1402c..e1c5fcf 100755 --- a/replay/replay.h +++ b/replay/replay.h @@ -76,6 +76,11 @@ time_t replay_time(void); In replay mode it just read from the log. */ void replay_get_timedate(struct tm *tm); +/* Events */ + +/*! Called when qemu shutdown is requested. */ +void replay_shutdown_request(void); + /* Asynchronous events queue */ /*! Disables storing events in the queue */ diff --git a/vl.c b/vl.c index baff3b5..905ea8a 100644 --- a/vl.c +++ b/vl.c @@ -1720,6 +1720,7 @@ void qemu_system_killed(int signal, pid_t pid) void qemu_system_shutdown_request(void) { trace_qemu_system_shutdown_request(); + replay_shutdown_request(); shutdown_requested = 1; qemu_notify_event(); }