Received: from eggs.gnu.org ([2001:4830:134:3::10]:39373) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yv6w9-0005KS-AZ for qemu-devel@nongnu.org; Wed, 20 May 2015 12:33:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yv6w4-0001AF-AL for qemu-devel@nongnu.org; Wed, 20 May 2015 12:33:41 -0400 Received: from e06smtp16.uk.ibm.com ([195.75.94.112]:55290) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yv6w4-00019R-1z for qemu-devel@nongnu.org; Wed, 20 May 2015 12:33:36 -0400 Received: from /spool/local by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 20 May 2015 17:33:35 +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 040922190046 for ; Wed, 20 May 2015 17:33:13 +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 t4KGXWUi7405918 for ; Wed, 20 May 2015 16:33:32 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 t4KGXVsP011995 for ; Wed, 20 May 2015 10:33:32 -0600 From: Cornelia Huck Date: Wed, 20 May 2015 18:33:24 +0200 Message-Id: <1432139606-23705-9-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 08/10] s390x: Add vector registers to ELF dump 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 Create ELF notes for the vector registers where applicable, so that their contents can be examined by utilities such as crash or readelf. Signed-off-by: Eric Farman Reviewed-by: David Hildenbrand Signed-off-by: Cornelia Huck --- target-s390x/arch_dump.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/target-s390x/arch_dump.c b/target-s390x/arch_dump.c index 36e8407..dab63eb 100644 --- a/target-s390x/arch_dump.c +++ b/target-s390x/arch_dump.c @@ -44,6 +44,18 @@ struct S390xElfFpregsetStruct { typedef struct S390xElfFpregsetStruct S390xElfFpregset; +struct S390xElfVregsLoStruct { + uint64_t vregs[16]; +} QEMU_PACKED; + +typedef struct S390xElfVregsLoStruct S390xElfVregsLo; + +struct S390xElfVregsHiStruct { + uint64_t vregs[16][2]; +} QEMU_PACKED; + +typedef struct S390xElfVregsHiStruct S390xElfVregsHi; + typedef struct noteStruct { Elf64_Nhdr hdr; char name[5]; @@ -51,6 +63,8 @@ typedef struct noteStruct { union { S390xElfPrstatus prstatus; S390xElfFpregset fpregset; + S390xElfVregsLo vregslo; + S390xElfVregsHi vregshi; uint32_t prefix; uint64_t timer; uint64_t todcmp; @@ -87,6 +101,29 @@ static void s390x_write_elf64_fpregset(Note *note, S390CPU *cpu) } } +static void s390x_write_elf64_vregslo(Note *note, S390CPU *cpu) +{ + int i; + + note->hdr.n_type = cpu_to_be32(NT_S390_VXRS_LOW); + for (i = 0; i <= 15; i++) { + note->contents.vregslo.vregs[i] = cpu_to_be64(cpu->env.vregs[i][1].ll); + } +} + +static void s390x_write_elf64_vregshi(Note *note, S390CPU *cpu) +{ + int i; + S390xElfVregsHi *temp_vregshi; + + temp_vregshi = ¬e->contents.vregshi; + + note->hdr.n_type = cpu_to_be32(NT_S390_VXRS_HIGH); + for (i = 0; i <= 15; i++) { + temp_vregshi->vregs[i][0] = cpu_to_be64(cpu->env.vregs[i + 16][0].ll); + temp_vregshi->vregs[i][1] = cpu_to_be64(cpu->env.vregs[i + 16][1].ll); + } +} static void s390x_write_elf64_timer(Note *note, S390CPU *cpu) { @@ -135,6 +172,8 @@ static const struct NoteFuncDescStruct { {sizeof(((Note *)0)->contents.timer), s390x_write_elf64_timer}, {sizeof(((Note *)0)->contents.todcmp), s390x_write_elf64_todcmp}, {sizeof(((Note *)0)->contents.todpreg), s390x_write_elf64_todpreg}, + {sizeof(((Note *)0)->contents.vregslo), s390x_write_elf64_vregslo}, + {sizeof(((Note *)0)->contents.vregshi), s390x_write_elf64_vregshi}, { 0, NULL} }; -- 2.4.1