qemu-arm
[Top][All Lists]
Advanced

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

[Qemu-arm] [RFC PATCH] hw/intc/arm_gic: Fix crash on register access fro


From: Jayachandran C
Subject: [Qemu-arm] [RFC PATCH] hw/intc/arm_gic: Fix crash on register access from monitor
Date: Tue, 22 Nov 2016 20:24:20 +0530

'current_cpu' is NULL when the GIC registers are accessed from
the monitor command line, and this causes qemu to crash in call
to gic_get_current_cpu().

Fix this by using the cpu returned by monitor_get_cpu_index()
for current cpu if current_cpu is NULL.

Signed-off-by: Jayachandran C <address@hidden>
---

This is marked RFC because I am not completely sure this is the right
fix. The issue is: qemu aarch64 with gicv2 crashes when reading the
GIC registers from monitor command line with 'xp'.
 
 hw/intc/arm_gic.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c
index 521aac3..17ef4fd 100644
--- a/hw/intc/arm_gic.c
+++ b/hw/intc/arm_gic.c
@@ -19,6 +19,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "monitor/monitor.h"
 #include "hw/sysbus.h"
 #include "gic_internal.h"
 #include "qapi/error.h"
@@ -49,6 +50,9 @@ static const uint8_t gic_id_gicv2[] = {
 
 static inline int gic_get_current_cpu(GICState *s)
 {
+    if (!current_cpu) {
+        return monitor_get_cpu_index();
+    }
     if (s->num_cpu > 1) {
         return current_cpu->cpu_index;
     }
-- 
2.7.4




reply via email to

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