diff options
author | Thomas Weißschuh <thomas@t-8ch.de> | 2024-05-23 09:09:17 +0200 |
---|---|---|
committer | Philippe Mathieu-Daudé <philmd@linaro.org> | 2024-06-04 11:53:43 +0200 |
commit | af1cf62401f01b1ecce1e2cd94fbd8410064418a (patch) | |
tree | ad6aedeccd84d0f7687af90d301743aa14e35466 | |
parent | 6ece1df96629de8e2381f06b876ceeb5fade758a (diff) | |
download | qemu-af1cf62401f01b1ecce1e2cd94fbd8410064418a.zip qemu-af1cf62401f01b1ecce1e2cd94fbd8410064418a.tar.gz qemu-af1cf62401f01b1ecce1e2cd94fbd8410064418a.tar.bz2 |
hw/misc/debugexit: use runstate API instead of plain exit()
Directly calling exit() prevents any kind of management or handling.
Instead use the corresponding runstate API.
The default behavior of the runstate API is the same as exit().
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20240523-debugexit-v1-1-d52fcaf7bf8b@t-8ch.de>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-rw-r--r-- | hw/misc/debugexit.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/misc/debugexit.c b/hw/misc/debugexit.c index ab6de69..c5c562f 100644 --- a/hw/misc/debugexit.c +++ b/hw/misc/debugexit.c @@ -12,6 +12,7 @@ #include "hw/qdev-properties.h" #include "qemu/module.h" #include "qom/object.h" +#include "sysemu/runstate.h" #define TYPE_ISA_DEBUG_EXIT_DEVICE "isa-debug-exit" OBJECT_DECLARE_SIMPLE_TYPE(ISADebugExitState, ISA_DEBUG_EXIT_DEVICE) @@ -32,7 +33,8 @@ static uint64_t debug_exit_read(void *opaque, hwaddr addr, unsigned size) static void debug_exit_write(void *opaque, hwaddr addr, uint64_t val, unsigned width) { - exit((val << 1) | 1); + qemu_system_shutdown_request_with_code(SHUTDOWN_CAUSE_GUEST_SHUTDOWN, + (val << 1) | 1); } static const MemoryRegionOps debug_exit_ops = { |