hw/intc/arm_gic: Fix crash on register access from monitor
RFC PATCH 1/1 hw/intc/arm_gic: Fix crash on register access from monitor
'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 <[email protected]>
---
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(+)
hw/intc/arm_gic.c +4 -0
@@ -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; }
Signature · 1 line
2.7.4