From patchwork Thu May 28 08:43:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 478115 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1YxtPZ-0000ZP-QJ for mharc-qemu-devel@gnu.org; Thu, 28 May 2015 04:43:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60708) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxtPL-0000CE-Mx for qemu-devel@nongnu.org; Thu, 28 May 2015 04:43:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YxtPG-0002VS-TQ for qemu-devel@nongnu.org; Thu, 28 May 2015 04:43:19 -0400 Received: from e06smtp10.uk.ibm.com ([195.75.94.106]:53813) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxtPG-0002Un-LF for qemu-devel@nongnu.org; Thu, 28 May 2015 04:43:14 -0400 Received: from /spool/local by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 28 May 2015 09:43:13 +0100 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 28 May 2015 09:43:11 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 4477D2190056 for ; Thu, 28 May 2015 09:42:51 +0100 (BST) Received: from d06av08.portsmouth.uk.ibm.com (d06av08.portsmouth.uk.ibm.com [9.149.37.249]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t4S8hBMT26738724 for ; Thu, 28 May 2015 08:43:11 GMT Received: from d06av08.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t4S8hAMB032132 for ; Thu, 28 May 2015 02:43:10 -0600 Received: from gondolin.boeblingen.de.ibm.com (dyn-9-152-224-143.boeblingen.de.ibm.com [9.152.224.143]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t4S8h7uG031905; Thu, 28 May 2015 02:43:10 -0600 From: Cornelia Huck To: peter.maydell@linaro.org Date: Thu, 28 May 2015 10:43:03 +0200 Message-Id: <1432802585-10765-9-git-send-email-cornelia.huck@de.ibm.com> X-Mailer: git-send-email 2.4.2 In-Reply-To: <1432802585-10765-1-git-send-email-cornelia.huck@de.ibm.com> References: <1432802585-10765-1-git-send-email-cornelia.huck@de.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15052808-0041-0000-0000-00000468DC3C X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.75.94.106 Cc: Eric Farman , qemu-devel@nongnu.org, agraf@suse.de, borntraeger@de.ibm.com, jfrei@linux.vnet.ibm.com, Cornelia Huck Subject: [Qemu-devel] [PULL 08/10] s390x: Add vector registers to ELF dump X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 May 2015 08:43:25 -0000 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} };