Received: from eggs.gnu.org ([2001:4830:134:3::10]:39385) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yv6w9-0005KX-Ig for qemu-devel@nongnu.org; Wed, 20 May 2015 12:33:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yv6w4-0001AV-G9 for qemu-devel@nongnu.org; Wed, 20 May 2015 12:33:41 -0400 Received: from e06smtp12.uk.ibm.com ([195.75.94.108]:50650) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yv6w4-000192-8R for qemu-devel@nongnu.org; Wed, 20 May 2015 12:33:36 -0400 Received: from /spool/local by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 20 May 2015 17:33:33 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 608FC2190061 for ; Wed, 20 May 2015 17:33:12 +0100 (BST) Received: from d06av05.portsmouth.uk.ibm.com (d06av05.portsmouth.uk.ibm.com [9.149.37.229]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t4KGXVOa9896402 for ; Wed, 20 May 2015 16:33:31 GMT Received: from d06av05.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t4KGXVEL011951 for ; Wed, 20 May 2015 10:33:31 -0600 From: Cornelia Huck Date: Wed, 20 May 2015 18:33:21 +0200 Message-Id: <1432139606-23705-6-git-send-email-cornelia.huck@de.ibm.com> In-Reply-To: <1432139606-23705-1-git-send-email-cornelia.huck@de.ibm.com> References: <1432139606-23705-1-git-send-email-cornelia.huck@de.ibm.com> Subject: [Qemu-devel] [PATCH 05/10] s390x: gdb updates for vector registers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Eric Farman , borntraeger@de.ibm.com, jfrei@linux.vnet.ibm.com, Cornelia Huck , agraf@suse.de From: Eric Farman gdb allows registers to be displayed/modified, and is being updated to account for the new vector registers. Mirror these changes in the gdb stub in qemu so that this can be performed when gdb is attached to the qemu gdbserver. Signed-off-by: Eric Farman Reviewed-by: David Hildenbrand Signed-off-by: Cornelia Huck --- configure | 2 +- target-s390x/gdbstub.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 1f0f485..1357052 100755 --- a/configure +++ b/configure @@ -5252,7 +5252,7 @@ case "$target_name" in echo "TARGET_ABI32=y" >> $config_target_mak ;; s390x) - gdb_xml_files="s390x-core64.xml s390-acr.xml s390-fpr.xml" + gdb_xml_files="s390x-core64.xml s390-acr.xml s390-fpr.xml s390-vx.xml" ;; tricore) ;; diff --git a/target-s390x/gdbstub.c b/target-s390x/gdbstub.c index 40bdfe7..ddc14a6 100644 --- a/target-s390x/gdbstub.c +++ b/target-s390x/gdbstub.c @@ -131,6 +131,48 @@ static int cpu_write_fp_reg(CPUS390XState *env, uint8_t *mem_buf, int n) } } +/* the values represent the positions in s390-vx.xml */ +#define S390_V0L_REGNUM 0 +#define S390_V15L_REGNUM 15 +#define S390_V16_REGNUM 16 +#define S390_V31_REGNUM 31 +/* total number of registers in s390-vx.xml */ +#define S390_NUM_VREGS 32 + +static int cpu_read_vreg(CPUS390XState *env, uint8_t *mem_buf, int n) +{ + int ret; + + switch (n) { + case S390_V0L_REGNUM ... S390_V15L_REGNUM: + ret = gdb_get_reg64(mem_buf, env->vregs[n][1].ll); + break; + case S390_V16_REGNUM ... S390_V31_REGNUM: + ret = gdb_get_reg64(mem_buf, env->vregs[n][0].ll); + ret += gdb_get_reg64(mem_buf + 8, env->vregs[n][1].ll); + break; + default: + ret = 0; + } + + return ret; +} + +static int cpu_write_vreg(CPUS390XState *env, uint8_t *mem_buf, int n) +{ + switch (n) { + case S390_V0L_REGNUM ... S390_V15L_REGNUM: + env->vregs[n][1].ll = ldtul_p(mem_buf + 8); + return 8; + case S390_V16_REGNUM ... S390_V31_REGNUM: + env->vregs[n][0].ll = ldtul_p(mem_buf); + env->vregs[n][1].ll = ldtul_p(mem_buf + 8); + return 16; + default: + return 0; + } +} + void s390_cpu_gdb_init(CPUState *cs) { gdb_register_coprocessor(cs, cpu_read_ac_reg, @@ -140,4 +182,8 @@ void s390_cpu_gdb_init(CPUState *cs) gdb_register_coprocessor(cs, cpu_read_fp_reg, cpu_write_fp_reg, S390_NUM_FP_REGS, "s390-fpr.xml", 0); + + gdb_register_coprocessor(cs, cpu_read_vreg, + cpu_write_vreg, + S390_NUM_VREGS, "s390-vx.xml", 0); } -- 2.4.1