[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 07/20] mcdstub: quitting QEMU via mcd command added
|
From: |
Nicolas Eder |
|
Subject: |
[PATCH v3 07/20] mcdstub: quitting QEMU via mcd command added |
|
Date: |
Tue, 7 Nov 2023 14:03:10 +0100 |
---
include/mcdstub/mcdstub.h | 9 +++++++++
mcdstub/mcdstub.c | 15 +++++++++++++++
2 files changed, 24 insertions(+)
diff --git a/include/mcdstub/mcdstub.h b/include/mcdstub/mcdstub.h
index c7e34673a6..c3e9c7e9dc 100644
--- a/include/mcdstub/mcdstub.h
+++ b/include/mcdstub/mcdstub.h
@@ -356,6 +356,15 @@ int mcd_handle_packet(const char *line_buf);
*/
void mcd_put_strbuf(void);
+/**
+ * mcd_exit() - Terminates QEMU.
+ *
+ * If the mcdserver_state has not been initialized the function exits before
+ * terminating QEMU. Terminting is done with the qemu_chr_fe_deinit function.
+ * @code: An exitcode, which can be used in the future.
+ */
+void mcd_exit(int code);
+
/**
* run_cmd_parser() - Prepares the mcdserver_state before executing TCP packet
* functions.
diff --git a/mcdstub/mcdstub.c b/mcdstub/mcdstub.c
index d2f6df04c0..858e79632b 100644
--- a/mcdstub/mcdstub.c
+++ b/mcdstub/mcdstub.c
@@ -340,6 +340,11 @@ int mcd_handle_packet(const char *line_buf)
cmd_parser = &open_server_cmd_desc;
}
break;
+ case TCP_CHAR_KILLQEMU:
+ /* kill qemu completely */
+ error_report("QEMU: Terminated via MCDstub");
+ mcd_exit(0);
+ exit(0);
case TCP_CHAR_CLOSE_SERVER:
{
static MCDCmdParseEntry close_server_cmd_desc = {
@@ -492,6 +497,16 @@ int process_string_cmd(void *user_ctx, const char *data,
return -1;
}
+void mcd_exit(int code)
+{
+ /* terminate qemu */
+ if (!mcdserver_state.init) {
+ return;
+ }
+
+ qemu_chr_fe_deinit(&mcdserver_system_state.chr, true);
+}
+
void mcd_chr_event(void *opaque, QEMUChrEvent event)
{
int i;
--
2.34.1
- [PATCH v3 00/20] first version of mcdstub, Nicolas Eder, 2023/11/07
- [PATCH v3 01/20] mcdstub: initial file structure for new mcdstub created. -mcd QEMU startup option added. Functions for initializing the mcdstub added. Basic helper functions for processes/cpus in the mcdstub added, Nicolas Eder, 2023/11/07
- [PATCH v3 07/20] mcdstub: quitting QEMU via mcd command added,
Nicolas Eder <=
- [PATCH v3 10/20] mcdstub: state query added: this query collects information about the state of a specific core. This commit also includes mcd_vm_state_change, which is called when the cpu state changes because it collects data for the query, Nicolas Eder, 2023/11/07
- [PATCH v3 09/20] mcdstub: open/close core added. This includes core specific data preparation: memory spaces, register groups and registers. This data preparation is done in the arm mcdstub, Nicolas Eder, 2023/11/07
- [PATCH v3 08/20] mcdstub: query packet processing added and core/system querie added, Nicolas Eder, 2023/11/07
- [PATCH v3 05/20] mcdstub: tcp packet processing added, Nicolas Eder, 2023/11/07
- [PATCH v3 20/20] mcdstub: updated MAINTAINERS file and fully activated the mcdstub in the meson build system, Nicolas Eder, 2023/11/07
- [PATCH v3 18/20] mcdstub: read/write to memory added: This also includes various helper functions in the QEMU memory code, Nicolas Eder, 2023/11/07