@@ -32,6 +32,7 @@
#include "exec/address-spaces.h"
#include "exec/tswap.h"
#include "sysemu/dma.h"
+#include "sysemu/runstate.h"
#define RISCV_DEBUG_HTIF 0
#define HTIF_DEBUG(fmt, ...) \
@@ -206,7 +207,9 @@ static void htif_handle_tohost_write(HTIFState *s, uint64_t val_written)
g_free(sig_data);
}
- exit(exit_code);
+ qemu_system_shutdown_request_with_code(
+ SHUTDOWN_CAUSE_GUEST_SHUTDOWN, exit_code);
+ return;
} else {
uint64_t syscall[8];
cpu_physical_memory_read(payload, syscall, sizeof(syscall));