Blame SOURCES/kvm-Define-the-architecture-for-compressed-dump-format.patch

958e1b
From da105287a0b61d57f015299cdf5211ba2e21a70f Mon Sep 17 00:00:00 2001
958e1b
From: Laszlo Ersek <lersek@redhat.com>
958e1b
Date: Fri, 7 Nov 2014 17:18:04 +0100
958e1b
Subject: [PATCH 17/41] Define the architecture for compressed dump format
958e1b
958e1b
Message-id: <1415380693-16593-18-git-send-email-lersek@redhat.com>
958e1b
Patchwork-id: 62203
958e1b
O-Subject: [RHEL-7.1 qemu-kvm PATCH 17/26] Define the architecture for compressed dump format
958e1b
Bugzilla: 1157798
958e1b
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
958e1b
RH-Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
958e1b
RH-Acked-by: dgibson <dgibson@redhat.com>
958e1b
958e1b
From: qiaonuohan <qiaonuohan@cn.fujitsu.com>
958e1b
958e1b
Signed-off-by: Ekaterina Tumanova <tumanova@linux.vnet.ibm.com>
958e1b
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
958e1b
Reviewed-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
958e1b
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
958e1b
(cherry picked from commit 4ab23a918249772458fd330758dc0fad96edce50)
958e1b
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
958e1b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
958e1b
---
958e1b
 dump.c             | 7 +++++--
958e1b
 target-i386/cpu.h  | 2 ++
958e1b
 target-s390x/cpu.h | 1 +
958e1b
 3 files changed, 8 insertions(+), 2 deletions(-)
958e1b
958e1b
diff --git a/dump.c b/dump.c
958e1b
index c0d5877..507a250 100644
958e1b
--- a/dump.c
958e1b
+++ b/dump.c
958e1b
@@ -32,6 +32,9 @@
958e1b
 #ifdef CONFIG_SNAPPY
958e1b
 #include <snappy-c.h>
958e1b
 #endif
958e1b
+#ifndef ELF_MACHINE_UNAME
958e1b
+#define ELF_MACHINE_UNAME "Unknown"
958e1b
+#endif
958e1b
 
958e1b
 static uint16_t cpu_convert_to_target16(uint16_t val, int endian)
958e1b
 {
958e1b
@@ -823,7 +826,7 @@ static int create_header32(DumpState *s)
958e1b
     dh->nr_cpus = cpu_convert_to_target32(s->nr_cpus, endian);
958e1b
     bitmap_blocks = DIV_ROUND_UP(s->len_dump_bitmap, block_size) * 2;
958e1b
     dh->bitmap_blocks = cpu_convert_to_target32(bitmap_blocks, endian);
958e1b
-    memcpy(&(dh->utsname.machine), "i686", 4);
958e1b
+    strncpy(dh->utsname.machine, ELF_MACHINE_UNAME, sizeof(dh->utsname.machine));
958e1b
 
958e1b
     if (s->flag_compress & DUMP_DH_COMPRESSED_ZLIB) {
958e1b
         status |= DUMP_DH_COMPRESSED_ZLIB;
958e1b
@@ -930,7 +933,7 @@ static int create_header64(DumpState *s)
958e1b
     dh->nr_cpus = cpu_convert_to_target32(s->nr_cpus, endian);
958e1b
     bitmap_blocks = DIV_ROUND_UP(s->len_dump_bitmap, block_size) * 2;
958e1b
     dh->bitmap_blocks = cpu_convert_to_target32(bitmap_blocks, endian);
958e1b
-    memcpy(&(dh->utsname.machine), "x86_64", 6);
958e1b
+    strncpy(dh->utsname.machine, ELF_MACHINE_UNAME, sizeof(dh->utsname.machine));
958e1b
 
958e1b
     if (s->flag_compress & DUMP_DH_COMPRESSED_ZLIB) {
958e1b
         status |= DUMP_DH_COMPRESSED_ZLIB;
958e1b
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
958e1b
index ad40aab..207645c 100644
958e1b
--- a/target-i386/cpu.h
958e1b
+++ b/target-i386/cpu.h
958e1b
@@ -38,8 +38,10 @@
958e1b
 
958e1b
 #ifdef TARGET_X86_64
958e1b
 #define ELF_MACHINE     EM_X86_64
958e1b
+#define ELF_MACHINE_UNAME "x86_64"
958e1b
 #else
958e1b
 #define ELF_MACHINE     EM_386
958e1b
+#define ELF_MACHINE_UNAME "i686"
958e1b
 #endif
958e1b
 
958e1b
 #define CPUArchState struct CPUX86State
958e1b
diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h
958e1b
index 0ce82cf..4979e0e 100644
958e1b
--- a/target-s390x/cpu.h
958e1b
+++ b/target-s390x/cpu.h
958e1b
@@ -28,6 +28,7 @@
958e1b
 #define TARGET_LONG_BITS 64
958e1b
 
958e1b
 #define ELF_MACHINE	EM_S390
958e1b
+#define ELF_MACHINE_UNAME "S390X"
958e1b
 
958e1b
 #define CPUArchState struct CPUS390XState
958e1b
 
958e1b
-- 
958e1b
1.8.3.1
958e1b