thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
62547e
From cbb653d73e32513ccd46b293a52384eed6a5f84f Mon Sep 17 00:00:00 2001
62547e
From: Janosch Frank <frankja@linux.ibm.com>
62547e
Date: Wed, 30 Mar 2022 12:36:02 +0000
62547e
Subject: [PATCH 20/42] dump: Cleanup dump_begin write functions
62547e
MIME-Version: 1.0
62547e
Content-Type: text/plain; charset=UTF-8
62547e
Content-Transfer-Encoding: 8bit
62547e
62547e
RH-Author: Cédric Le Goater <clg@redhat.com>
62547e
RH-MergeRequest: 226: s390: Enhanced Interpretation for PCI Functions and Secure Execution guest dump
62547e
RH-Bugzilla: 1664378 2043909
62547e
RH-Acked-by: Thomas Huth <thuth@redhat.com>
62547e
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
62547e
RH-Acked-by: Jon Maloy <jmaloy@redhat.com>
62547e
RH-Commit: [20/41] 18ea1457a3e54fd368e556d96c3be50c6ad0a6bd
62547e
62547e
There's no need to have a gigantic if in there let's move the elf
62547e
32/64 bit logic into the section, segment or note code.
62547e
62547e
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
62547e
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
62547e
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
62547e
Message-Id: <20220330123603.107120-9-frankja@linux.ibm.com>
62547e
(cherry picked from commit 5ff2e5a3e1e67930e523486e39549a33fcf97227)
62547e
Signed-off-by: Cédric Le Goater <clg@redhat.com>
62547e
---
62547e
 dump/dump.c | 42 +++++++++++-------------------------------
62547e
 1 file changed, 11 insertions(+), 31 deletions(-)
62547e
62547e
diff --git a/dump/dump.c b/dump/dump.c
62547e
index 823ca32883..88abde355a 100644
62547e
--- a/dump/dump.c
62547e
+++ b/dump/dump.c
62547e
@@ -565,46 +565,26 @@ static void dump_begin(DumpState *s, Error **errp)
62547e
         return;
62547e
     }
62547e
 
62547e
-    if (dump_is_64bit(s)) {
62547e
-        /* write all PT_LOAD to vmcore */
62547e
-        write_elf_loads(s, errp);
62547e
+    /* write all PT_LOAD to vmcore */
62547e
+    write_elf_loads(s, errp);
62547e
+    if (*errp) {
62547e
+        return;
62547e
+    }
62547e
+
62547e
+    /* write section to vmcore */
62547e
+    if (s->shdr_num) {
62547e
+        write_elf_section(s, 1, errp);
62547e
         if (*errp) {
62547e
             return;
62547e
         }
62547e
+    }
62547e
 
62547e
-        /* write section to vmcore */
62547e
-        if (s->shdr_num) {
62547e
-            write_elf_section(s, 1, errp);
62547e
-            if (*errp) {
62547e
-                return;
62547e
-            }
62547e
-        }
62547e
-
62547e
+    if (dump_is_64bit(s)) {
62547e
         /* write notes to vmcore */
62547e
         write_elf64_notes(fd_write_vmcore, s, errp);
62547e
-        if (*errp) {
62547e
-            return;
62547e
-        }
62547e
     } else {
62547e
-        /* write all PT_LOAD to vmcore */
62547e
-        write_elf_loads(s, errp);
62547e
-        if (*errp) {
62547e
-            return;
62547e
-        }
62547e
-
62547e
-        /* write section to vmcore */
62547e
-        if (s->shdr_num) {
62547e
-            write_elf_section(s, 0, errp);
62547e
-            if (*errp) {
62547e
-                return;
62547e
-            }
62547e
-        }
62547e
-
62547e
         /* write notes to vmcore */
62547e
         write_elf32_notes(fd_write_vmcore, s, errp);
62547e
-        if (*errp) {
62547e
-            return;
62547e
-        }
62547e
     }
62547e
 }
62547e
 
62547e
-- 
62547e
2.37.3
62547e