summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorEric Farman <farman@linux.vnet.ibm.com>2014-05-29 14:54:26 -0400
committerCornelia Huck <cornelia.huck@de.ibm.com>2015-05-27 17:52:03 +0200
commit3ceeb2930faf1116ee4bb22c8a7794bb2337e8a9 (patch)
tree53f922adfb4d9920bd183d0f1fb6962b9229fb53
parenteeef559ab4a80753b7bf31728780692a3a4e3ec1 (diff)
downloadfocaccia-qemu-3ceeb2930faf1116ee4bb22c8a7794bb2337e8a9.tar.gz
focaccia-qemu-3ceeb2930faf1116ee4bb22c8a7794bb2337e8a9.zip
s390x: Add vector registers to ELF dump
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 <farman@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
-rw-r--r--target-s390x/arch_dump.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/target-s390x/arch_dump.c b/target-s390x/arch_dump.c
index 36e8407283..dab63eb44f 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 = &note->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}
 };