qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 2/2] pvpanic: add PVPANIC_ABORT_PROP


From: Sergio Lopez
Subject: [Qemu-devel] [PATCH 2/2] pvpanic: add PVPANIC_ABORT_PROP
Date: Fri, 29 Dec 2017 10:42:06 +0100

PVPANIC_ABORT_PROP is a boolean to instruct pvpanic to request an
abort() of the process when the Guest signals a panic.

Signed-off-by: Sergio Lopez <address@hidden>
---
 hw/misc/pvpanic.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c
index 4fb074df06..c901458297 100644
--- a/hw/misc/pvpanic.c
+++ b/hw/misc/pvpanic.c
@@ -28,7 +28,7 @@
 #define ISA_PVPANIC_DEVICE(obj)    \
     OBJECT_CHECK(PVPanicState, (obj), TYPE_PVPANIC)
 
-static void handle_event(int event)
+static void handle_event(int event, bool abort_on_panic)
 {
     static bool logged;
 
@@ -38,7 +38,7 @@ static void handle_event(int event)
     }
 
     if (event & PVPANIC_PANICKED) {
-        qemu_system_guest_panicked(NULL, false);
+        qemu_system_guest_panicked(NULL, abort_on_panic);
         return;
     }
 }
@@ -50,6 +50,7 @@ typedef struct PVPanicState {
 
     MemoryRegion io;
     uint16_t ioport;
+    bool abort_on_panic;
 } PVPanicState;
 
 /* return supported events on read */
@@ -61,7 +62,8 @@ static uint64_t pvpanic_ioport_read(void *opaque, hwaddr 
addr, unsigned size)
 static void pvpanic_ioport_write(void *opaque, hwaddr addr, uint64_t val,
                                  unsigned size)
 {
-    handle_event(val);
+    PVPanicState *s = opaque;
+    handle_event(val, s->abort_on_panic);
 }
 
 static const MemoryRegionOps pvpanic_ops = {
@@ -100,6 +102,7 @@ static void pvpanic_isa_realizefn(DeviceState *dev, Error 
**errp)
 }
 
 #define PVPANIC_IOPORT_PROP "ioport"
+#define PVPANIC_ABORT_PROP "abort"
 
 uint16_t pvpanic_port(void)
 {
@@ -112,6 +115,7 @@ uint16_t pvpanic_port(void)
 
 static Property pvpanic_isa_properties[] = {
     DEFINE_PROP_UINT16(PVPANIC_IOPORT_PROP, PVPanicState, ioport, 0x505),
+    DEFINE_PROP_BOOL(PVPANIC_ABORT_PROP, PVPanicState, abort_on_panic, false),
     DEFINE_PROP_END_OF_LIST(),
 };
 
-- 
2.14.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]