cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-dump-select-header-bitness-based-on-ELF-class-not-EL.patch

9ae3a8
From c4249cf0d89f6a5ba4448eb1ff22f496387d0e50 Mon Sep 17 00:00:00 2001
9ae3a8
From: Laszlo Ersek <lersek@redhat.com>
9ae3a8
Date: Fri, 7 Nov 2014 17:18:11 +0100
9ae3a8
Subject: [PATCH 24/41] dump: select header bitness based on ELF class, not ELF
9ae3a8
 architecture
9ae3a8
9ae3a8
Message-id: <1415380693-16593-25-git-send-email-lersek@redhat.com>
9ae3a8
Patchwork-id: 62212
9ae3a8
O-Subject: [RHEL-7.1 qemu-kvm PATCH 24/26] dump: select header bitness based on ELF class, not ELF architecture
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
The specific ELF architecture (d_machine) carries Too Much Information
9ae3a8
(TM) for deciding between create_header32() and create_header64(), use
9ae3a8
"d_class" instead (ELFCLASS32 vs. ELFCLASS64).
9ae3a8
9ae3a8
This change adapts write_dump_header() to write_elf_loads(), dump_begin()
9ae3a8
etc. that also rely on the ELF class of the target for bitness selection.
9ae3a8
9ae3a8
Considering the current targets that support dumping, cpu_get_dump_info()
9ae3a8
works as follows:
9ae3a8
- target-s390x/arch_dump.c: (EM_S390, ELFCLASS64) only
9ae3a8
- target-ppc/arch_dump.c (EM_PPC64, ELFCLASS64) only
9ae3a8
- target-i386/arch_dump.c: sets (EM_X86_64, ELFCLASS64) vs. (EM_386,
9ae3a8
  ELFCLASS32) keying off the same Long Mode Active flag.
9ae3a8
9ae3a8
Hence no observable change.
9ae3a8
9ae3a8
Approximately-suggested-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
9ae3a8
(cherry picked from commit 24aeeace7a9f264688e9eda77b6c04db607cbdfd)
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 dump.c | 2 +-
9ae3a8
 1 file changed, 1 insertion(+), 1 deletion(-)
9ae3a8
9ae3a8
diff --git a/dump.c b/dump.c
9ae3a8
index f8e0fd7..450f658 100644
9ae3a8
--- a/dump.c
9ae3a8
+++ b/dump.c
9ae3a8
@@ -1006,7 +1006,7 @@ out:
9ae3a8
 
9ae3a8
 static int write_dump_header(DumpState *s)
9ae3a8
 {
9ae3a8
-    if (s->dump_info.d_machine == EM_386) {
9ae3a8
+    if (s->dump_info.d_class == ELFCLASS32) {
9ae3a8
         return create_header32(s);
9ae3a8
     } else {
9ae3a8
         return create_header64(s);
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8