The to be deprecated MonitorDef provided a synthetic $pc alias on
x86 (which begin as an $eip alias). Preserving it requires x86-specific
semantics (CPUClass::get_pc() omits the historical truncation).
Use $eip or $rip instead, adding $cs.base as required.

It was never a documented feature, HMP is not a stable API, x86-only,
and the replacement ($rip/$eip + $cs.base) is arguably more correct.
Nobody asked for a deprecation window on ML either.

Signed-off-by: Marc-André Lureau <[email protected]>
---
 docs/about/removed-features.rst |  8 ++++++++
 target/i386/cpu.c               | 23 -----------------------
 tests/qtest/test-hmp.c          |  1 -
 3 files changed, 8 insertions(+), 24 deletions(-)

diff --git a/docs/about/removed-features.rst b/docs/about/removed-features.rst
index 6a9944a0c794..444169b5b718 100644
--- a/docs/about/removed-features.rst
+++ b/docs/about/removed-features.rst
@@ -908,6 +908,14 @@ Use ``multifd-channels`` instead.
 
 Use ``multifd-compression`` instead.
 
+``$pc`` register alias on x86 (removed in 11.2)
+'''''''''''''''''''''''''''''''''''''''''''''''
+
+The ``$pc`` alias (the linear instruction pointer) is no longer
+recognized in HMP expressions. Use ``$rip`` or ``$eip`` (depending
+on the target) instead, adding ``$cs.base`` when the linear address
+is needed.
+
 Host Architectures
 ------------------
 
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 2f5ea4e51715..a28c3033ba6d 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -42,7 +42,6 @@
 #include "exec/watchpoint.h"
 #ifndef CONFIG_USER_ONLY
 #include "confidential-guest.h"
-#include "monitor/hmp.h"
 #include "system/reset.h"
 #include "qapi/qapi-commands-machine.h"
 #include "system/qmp-cpu.h"
@@ -10907,25 +10906,6 @@ static const Property x86_cpu_properties[] = {
 
 #ifndef CONFIG_USER_ONLY
 
-#ifdef CONFIG_HMP
-static int64_t monitor_get_pc(MonitorHMP *hmp, const struct MonitorDef *md,
-                              int offset)
-{
-    CPUArchState *env = monitor_hmp_get_cpu_env(hmp);
-    int64_t ret = env->eip + env->segs[R_CS].base;
-
-    if (!(env->hflags & HF_CS64_MASK)) {
-        ret = (int32_t)ret;
-    }
-    return ret;
-}
-
-static const MonitorDef x86_monitor_defs[] = {
-    { "pc", 0, monitor_get_pc, },
-    { NULL },
-};
-#endif
-
 #include "hw/core/sysemu-cpu-ops.h"
 
 static const struct SysemuCPUOps i386_sysemu_ops = {
@@ -10939,9 +10919,6 @@ static const struct SysemuCPUOps i386_sysemu_ops = {
     .write_elf64_note = x86_cpu_write_elf64_note,
     .write_elf32_qemunote = x86_cpu_write_elf32_qemunote,
     .write_elf64_qemunote = x86_cpu_write_elf64_qemunote,
-#ifdef CONFIG_HMP
-    .monitor_defs = x86_monitor_defs,
-#endif
     .legacy_vmsd = &vmstate_x86_cpu,
 };
 #endif
diff --git a/tests/qtest/test-hmp.c b/tests/qtest/test-hmp.c
index a523dbb446ce..b3f8fd58612d 100644
--- a/tests/qtest/test-hmp.c
+++ b/tests/qtest/test-hmp.c
@@ -58,7 +58,6 @@ static const char *hmp_cmds[] = {
     "object_del mem1",
     "one-insn-per-tb on",
     "pmemsave 0 4096 \"/dev/null\"",
-    "p $pc + 8",
     "qom-list /",
     "qom-set /machine initrd test",
     "qom-get /machine initrd",

-- 
2.56.0.116.g6de20f6092dc


Reply via email to