qemu-devel
[Top][All Lists]
Advanced

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

[PATCH] arm/monitor: add register name resolution


From: Nikola Brkovic
Subject: [PATCH] arm/monitor: add register name resolution
Date: Sat, 10 Sep 2022 16:12:16 +0200

This patch allows the monitor to resolve the
stack pointer, instruction pointer,
system status register and FPU status register
on ARM targets.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1145

Signed-off-by: Nikola Brkovic <nb91605@student.uni-lj.si>
---
 target/arm/monitor.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/target/arm/monitor.c b/target/arm/monitor.c
index 80c64fa355..143c95bca4 100644
--- a/target/arm/monitor.c
+++ b/target/arm/monitor.c
@@ -31,6 +31,7 @@
 #include "qapi/qmp/qerror.h"
 #include "qapi/qmp/qdict.h"
 #include "qom/qom-qobject.h"
+#include "monitor/hmp-target.h"
 
 static GICCapability *gic_cap_new(int version)
 {
@@ -228,3 +229,31 @@ CpuModelExpansionInfo 
*qmp_query_cpu_model_expansion(CpuModelExpansionType type,
 
     return expansion_info;
 }
+
+static target_long monitor_get_cpsr(Monitor *mon, const struct MonitorDef *md,
+                                    int val)
+{
+    CPUArchState *env = mon_get_cpu_env(mon);
+    return cpsr_read(env);
+}
+
+const MonitorDef monitor_defs[] = {
+    { "sp|r13", offsetof(CPUARMState, regs[13])},
+    { "lr|r14", offsetof(CPUARMState, regs[14])},
+#ifndef TARGET_AARCH64
+    { "pc|r15|ip", offsetof(CPUARMState, regs[15]) },
+#else
+    { "pc|ip", offsetof(CPUARMState, pc) },
+#endif
+
+    /* State registers */
+    { "cpsr", 0, &monitor_get_cpsr},
+    { "fpscr", offsetof(CPUARMState, vfp.fp_status)},
+
+    { NULL }
+};
+
+const MonitorDef *target_monitor_defs(void)
+{
+    return monitor_defs;
+}
-- 
2.37.3




reply via email to

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