[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] s390x/gdb: Split s390-virt.xml
From: |
Ilya Leoshkevich |
Subject: |
[PATCH] s390x/gdb: Split s390-virt.xml |
Date: |
Mon, 13 Mar 2023 22:16:14 +0100 |
TCG emulates ckc, cputm, last_break and prefix, and it's quite useful
to have them during debugging.
So move them into the new s390-virt-tcg.xml file.
pp, pfault_token, pfault_select and pfault_compare are not emulated,
so keep them in s390-virt.xml.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
configs/targets/s390x-linux-user.mak | 2 +-
configs/targets/s390x-softmmu.mak | 2 +-
gdb-xml/s390-virt-tcg.xml | 14 +++++
gdb-xml/s390-virt.xml | 4 --
target/s390x/gdbstub.c | 82 ++++++++++++++++++----------
5 files changed, 69 insertions(+), 35 deletions(-)
create mode 100644 gdb-xml/s390-virt-tcg.xml
diff --git a/configs/targets/s390x-linux-user.mak
b/configs/targets/s390x-linux-user.mak
index e2978248ede..fb3e2b73be7 100644
--- a/configs/targets/s390x-linux-user.mak
+++ b/configs/targets/s390x-linux-user.mak
@@ -2,4 +2,4 @@ TARGET_ARCH=s390x
TARGET_SYSTBL_ABI=common,64
TARGET_SYSTBL=syscall.tbl
TARGET_BIG_ENDIAN=y
-TARGET_XML_FILES= gdb-xml/s390x-core64.xml gdb-xml/s390-acr.xml
gdb-xml/s390-fpr.xml gdb-xml/s390-vx.xml gdb-xml/s390-cr.xml
gdb-xml/s390-virt.xml gdb-xml/s390-gs.xml
+TARGET_XML_FILES= gdb-xml/s390x-core64.xml gdb-xml/s390-acr.xml
gdb-xml/s390-fpr.xml gdb-xml/s390-vx.xml gdb-xml/s390-cr.xml
gdb-xml/s390-virt.xml gdb-xml/s390-virt-tcg.xml gdb-xml/s390-gs.xml
diff --git a/configs/targets/s390x-softmmu.mak
b/configs/targets/s390x-softmmu.mak
index 258b4cf3582..554330d7c85 100644
--- a/configs/targets/s390x-softmmu.mak
+++ b/configs/targets/s390x-softmmu.mak
@@ -1,4 +1,4 @@
TARGET_ARCH=s390x
TARGET_BIG_ENDIAN=y
TARGET_SUPPORTS_MTTCG=y
-TARGET_XML_FILES= gdb-xml/s390x-core64.xml gdb-xml/s390-acr.xml
gdb-xml/s390-fpr.xml gdb-xml/s390-vx.xml gdb-xml/s390-cr.xml
gdb-xml/s390-virt.xml gdb-xml/s390-gs.xml
+TARGET_XML_FILES= gdb-xml/s390x-core64.xml gdb-xml/s390-acr.xml
gdb-xml/s390-fpr.xml gdb-xml/s390-vx.xml gdb-xml/s390-cr.xml
gdb-xml/s390-virt.xml gdb-xml/s390-virt-tcg.xml gdb-xml/s390-gs.xml
diff --git a/gdb-xml/s390-virt-tcg.xml b/gdb-xml/s390-virt-tcg.xml
new file mode 100644
index 00000000000..0f77c9b48c6
--- /dev/null
+++ b/gdb-xml/s390-virt-tcg.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<!-- Copyright 2023 IBM Corp.
+
+ This work is licensed under the terms of the GNU GPL, version 2 or
+ (at your option) any later version. See the COPYING file in the
+ top-level directory. -->
+
+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
+<feature name="org.gnu.gdb.s390.virt.tcg">
+ <reg name="ckc" bitsize="64" type="uint64" group="system"/>
+ <reg name="cputm" bitsize="64" type="uint64" group="system"/>
+ <reg name="last_break" bitsize="64" type="code_ptr" group="system"/>
+ <reg name="prefix" bitsize="64" type="data_ptr" group="system"/>
+</feature>
diff --git a/gdb-xml/s390-virt.xml b/gdb-xml/s390-virt.xml
index e2e9a7ad3cc..a79c0307682 100644
--- a/gdb-xml/s390-virt.xml
+++ b/gdb-xml/s390-virt.xml
@@ -7,10 +7,6 @@
<!DOCTYPE feature SYSTEM "gdb-target.dtd">
<feature name="org.gnu.gdb.s390.virt">
- <reg name="ckc" bitsize="64" type="uint64" group="system"/>
- <reg name="cputm" bitsize="64" type="uint64" group="system"/>
- <reg name="last_break" bitsize="64" type="code_ptr" group="system"/>
- <reg name="prefix" bitsize="64" type="data_ptr" group="system"/>
<reg name="pp" bitsize="64" type="uint64" group="system"/>
<reg name="pfault_token" bitsize="64" type="uint64" group="system"/>
<reg name="pfault_select" bitsize="64" type="uint64" group="system"/>
diff --git a/target/s390x/gdbstub.c b/target/s390x/gdbstub.c
index a5d69d0e0bc..111b695dc85 100644
--- a/target/s390x/gdbstub.c
+++ b/target/s390x/gdbstub.c
@@ -200,61 +200,81 @@ static int cpu_write_c_reg(CPUS390XState *env, uint8_t
*mem_buf, int n)
}
}
-/* the values represent the positions in s390-virt.xml */
-#define S390_VIRT_CKC_REGNUM 0
-#define S390_VIRT_CPUTM_REGNUM 1
-#define S390_VIRT_BEA_REGNUM 2
-#define S390_VIRT_PREFIX_REGNUM 3
-#define S390_VIRT_PP_REGNUM 4
-#define S390_VIRT_PFT_REGNUM 5
-#define S390_VIRT_PFS_REGNUM 6
-#define S390_VIRT_PFC_REGNUM 7
-/* total number of registers in s390-virt.xml */
-#define S390_NUM_VIRT_REGS 8
+/* the values represent the positions in s390-virt-tcg.xml */
+#define S390_VIRT_TCG_CKC_REGNUM 0
+#define S390_VIRT_TCG_CPUTM_REGNUM 1
+#define S390_VIRT_TCG_BEA_REGNUM 2
+#define S390_VIRT_TCG_PREFIX_REGNUM 3
+/* total number of registers in s390-virt-tcg.xml */
+#define S390_NUM_VIRT_TCG_REGS 4
-static int cpu_read_virt_reg(CPUS390XState *env, GByteArray *mem_buf, int n)
+static int cpu_read_virt_tcg_reg(CPUS390XState *env, GByteArray *mem_buf, int
n)
{
switch (n) {
- case S390_VIRT_CKC_REGNUM:
+ case S390_VIRT_TCG_CKC_REGNUM:
return gdb_get_regl(mem_buf, env->ckc);
- case S390_VIRT_CPUTM_REGNUM:
+ case S390_VIRT_TCG_CPUTM_REGNUM:
return gdb_get_regl(mem_buf, env->cputm);
- case S390_VIRT_BEA_REGNUM:
+ case S390_VIRT_TCG_BEA_REGNUM:
return gdb_get_regl(mem_buf, env->gbea);
- case S390_VIRT_PREFIX_REGNUM:
+ case S390_VIRT_TCG_PREFIX_REGNUM:
return gdb_get_regl(mem_buf, env->psa);
- case S390_VIRT_PP_REGNUM:
- return gdb_get_regl(mem_buf, env->pp);
- case S390_VIRT_PFT_REGNUM:
- return gdb_get_regl(mem_buf, env->pfault_token);
- case S390_VIRT_PFS_REGNUM:
- return gdb_get_regl(mem_buf, env->pfault_select);
- case S390_VIRT_PFC_REGNUM:
- return gdb_get_regl(mem_buf, env->pfault_compare);
default:
return 0;
}
}
-static int cpu_write_virt_reg(CPUS390XState *env, uint8_t *mem_buf, int n)
+static int cpu_write_virt_tcg_reg(CPUS390XState *env, uint8_t *mem_buf, int n)
{
switch (n) {
- case S390_VIRT_CKC_REGNUM:
+ case S390_VIRT_TCG_CKC_REGNUM:
env->ckc = ldtul_p(mem_buf);
cpu_synchronize_post_init(env_cpu(env));
return 8;
- case S390_VIRT_CPUTM_REGNUM:
+ case S390_VIRT_TCG_CPUTM_REGNUM:
env->cputm = ldtul_p(mem_buf);
cpu_synchronize_post_init(env_cpu(env));
return 8;
- case S390_VIRT_BEA_REGNUM:
+ case S390_VIRT_TCG_BEA_REGNUM:
env->gbea = ldtul_p(mem_buf);
cpu_synchronize_post_init(env_cpu(env));
return 8;
- case S390_VIRT_PREFIX_REGNUM:
+ case S390_VIRT_TCG_PREFIX_REGNUM:
env->psa = ldtul_p(mem_buf);
cpu_synchronize_post_init(env_cpu(env));
return 8;
+ default:
+ return 0;
+ }
+}
+
+/* the values represent the positions in s390-virt.xml */
+#define S390_VIRT_PP_REGNUM 0
+#define S390_VIRT_PFT_REGNUM 1
+#define S390_VIRT_PFS_REGNUM 2
+#define S390_VIRT_PFC_REGNUM 3
+/* total number of registers in s390-virt.xml */
+#define S390_NUM_VIRT_REGS 4
+
+static int cpu_read_virt_reg(CPUS390XState *env, GByteArray *mem_buf, int n)
+{
+ switch (n) {
+ case S390_VIRT_PP_REGNUM:
+ return gdb_get_regl(mem_buf, env->pp);
+ case S390_VIRT_PFT_REGNUM:
+ return gdb_get_regl(mem_buf, env->pfault_token);
+ case S390_VIRT_PFS_REGNUM:
+ return gdb_get_regl(mem_buf, env->pfault_select);
+ case S390_VIRT_PFC_REGNUM:
+ return gdb_get_regl(mem_buf, env->pfault_compare);
+ default:
+ return 0;
+ }
+}
+
+static int cpu_write_virt_reg(CPUS390XState *env, uint8_t *mem_buf, int n)
+{
+ switch (n) {
case S390_VIRT_PP_REGNUM:
env->pp = ldtul_p(mem_buf);
cpu_synchronize_post_init(env_cpu(env));
@@ -320,6 +340,10 @@ void s390_cpu_gdb_init(CPUState *cs)
cpu_write_c_reg,
S390_NUM_C_REGS, "s390-cr.xml", 0);
+ gdb_register_coprocessor(cs, cpu_read_virt_tcg_reg,
+ cpu_write_virt_tcg_reg,
+ S390_NUM_VIRT_TCG_REGS, "s390-virt-tcg.xml", 0);
+
if (kvm_enabled()) {
gdb_register_coprocessor(cs, cpu_read_virt_reg,
cpu_write_virt_reg,
--
2.39.2
- [PATCH] s390x/gdb: Split s390-virt.xml,
Ilya Leoshkevich <=