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