qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Lluís Vilanova" <vilanova@ac.upc.edu>
To: qemu-devel@nongnu.org
Cc: Alexander Graf <agraf@suse.de>, Thomas Huth <thuth@redhat.com>,
	"open list:Overall" <kvm@vger.kernel.org>,
	Stefan Hajnoczi <stefanha@gmail.com>,
	"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	"open list:PowerPC" <qemu-ppc@nongnu.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	David Gibson <david@gibson.dropbear.id.au>
Subject: [Qemu-devel] [PATCH v6 3/5] util: [ppc] Use new error_report_fatal() instead of exit()
Date: Tue,  2 Feb 2016 17:14:10 +0100	[thread overview]
Message-ID: <145442964969.1539.18333489538497601029.stgit@localhost> (raw)
In-Reply-To: <145442963048.1539.13602468921796488810.stgit@localhost>

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 target-ppc/kvm.c            |    5 +--
 target-ppc/translate.c      |    7 ++--
 target-ppc/translate_init.c |   80 +++++++++++++++++++++----------------------
 3 files changed, 44 insertions(+), 48 deletions(-)

diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index 70ca296..1bb87e6 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -316,9 +316,8 @@ static long gethugepagesize(const char *mem_path)
     } while (ret != 0 && errno == EINTR);
 
     if (ret != 0) {
-        fprintf(stderr, "Couldn't statfs() memory path: %s\n",
-                strerror(errno));
-        exit(1);
+        error_report_fatal("Couldn't statfs() memory path: %s",
+                           strerror(errno));
     }
 
 #define HUGETLBFS_MAGIC       0x958458f6
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index 7db3145..546b21d 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -11588,10 +11588,9 @@ void gen_intermediate_code(CPUPPCState *env, struct TranslationBlock *tb)
             break;
         }
         if (tcg_check_temp_count()) {
-            fprintf(stderr, "Opcode %02x %02x %02x (%08x) leaked temporaries\n",
-                    opc1(ctx.opcode), opc2(ctx.opcode), opc3(ctx.opcode),
-                    ctx.opcode);
-            exit(1);
+            error_report_fatal("Opcode %02x %02x %02x (%08x) leaked temporaries",
+                               opc1(ctx.opcode), opc2(ctx.opcode), opc3(ctx.opcode),
+                               ctx.opcode);
         }
     }
     if (tb->cflags & CF_LAST_IO)
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index cdd18ac..d66be51 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -620,8 +620,8 @@ static inline void _spr_register(CPUPPCState *env, int num,
         spr->oea_read != NULL || spr->oea_write != NULL ||
 #endif
         spr->uea_read != NULL || spr->uea_write != NULL) {
-        printf("Error: Trying to register SPR %d (%03x) twice !\n", num, num);
-        exit(1);
+        error_report_fatal("Error: Trying to register SPR %d (%03x) twice !",
+                           num, num);
     }
 #if defined(PPC_DEBUG_SPR)
     printf("*** register spr %d (%03x) %s val " TARGET_FMT_lx "\n", num, num,
@@ -1609,8 +1609,7 @@ static void gen_spr_BookE (CPUPPCState *env, uint64_t ivor_mask)
     for (i = 0; i < 64; i++) {
         if (ivor_mask & (1ULL << i)) {
             if (ivor_sprn[i] == SPR_BOOKE_IVORxx) {
-                fprintf(stderr, "ERROR: IVOR %d SPR is not defined\n", i);
-                exit(1);
+                error_report_fatal("ERROR: IVOR %d SPR is not defined", i);
             }
             spr_register(env, ivor_sprn[i], ivor_names[i],
                          SPR_NOACCESS, SPR_NOACCESS,
@@ -8352,14 +8351,14 @@ static void init_ppc_proc(PowerPCCPU *cpu)
         case POWERPC_FLAG_VRE:
             break;
         default:
-            fprintf(stderr, "PowerPC MSR definition inconsistency\n"
-                    "Should define POWERPC_FLAG_SPE or POWERPC_FLAG_VRE\n");
-            exit(1);
+            error_report("PowerPC MSR definition inconsistency");
+            error_report_fatal(
+                "Should define POWERPC_FLAG_SPE or POWERPC_FLAG_VRE");
         }
     } else if (env->flags & (POWERPC_FLAG_SPE | POWERPC_FLAG_VRE)) {
-        fprintf(stderr, "PowerPC MSR definition inconsistency\n"
-                "Should not define POWERPC_FLAG_SPE nor POWERPC_FLAG_VRE\n");
-        exit(1);
+        error_report("PowerPC MSR definition inconsistency");
+        error_report_fatal(
+            "Should not define POWERPC_FLAG_SPE nor POWERPC_FLAG_VRE");
     }
     if (env->msr_mask & (1 << 17)) {
         switch (env->flags & (POWERPC_FLAG_TGPR | POWERPC_FLAG_CE)) {
@@ -8367,14 +8366,14 @@ static void init_ppc_proc(PowerPCCPU *cpu)
         case POWERPC_FLAG_CE:
             break;
         default:
-            fprintf(stderr, "PowerPC MSR definition inconsistency\n"
-                    "Should define POWERPC_FLAG_TGPR or POWERPC_FLAG_CE\n");
-            exit(1);
+            error_report("PowerPC MSR definition inconsistency");
+            error_report_fatal(
+                "Should define POWERPC_FLAG_TGPR or POWERPC_FLAG_CE");
         }
     } else if (env->flags & (POWERPC_FLAG_TGPR | POWERPC_FLAG_CE)) {
-        fprintf(stderr, "PowerPC MSR definition inconsistency\n"
-                "Should not define POWERPC_FLAG_TGPR nor POWERPC_FLAG_CE\n");
-        exit(1);
+        error_report("PowerPC MSR definition inconsistency");
+        error_report_fatal(
+            "Should not define POWERPC_FLAG_TGPR nor POWERPC_FLAG_CE");
     }
     if (env->msr_mask & (1 << 10)) {
         switch (env->flags & (POWERPC_FLAG_SE | POWERPC_FLAG_DWE |
@@ -8384,17 +8383,17 @@ static void init_ppc_proc(PowerPCCPU *cpu)
         case POWERPC_FLAG_UBLE:
             break;
         default:
-            fprintf(stderr, "PowerPC MSR definition inconsistency\n"
-                    "Should define POWERPC_FLAG_SE or POWERPC_FLAG_DWE or "
-                    "POWERPC_FLAG_UBLE\n");
-            exit(1);
+            error_report("PowerPC MSR definition inconsistency");
+            error_report_fatal(
+                "Should define POWERPC_FLAG_SE or POWERPC_FLAG_DWE or "
+                "POWERPC_FLAG_UBLE");
         }
     } else if (env->flags & (POWERPC_FLAG_SE | POWERPC_FLAG_DWE |
                              POWERPC_FLAG_UBLE)) {
-        fprintf(stderr, "PowerPC MSR definition inconsistency\n"
-                "Should not define POWERPC_FLAG_SE nor POWERPC_FLAG_DWE nor "
-                "POWERPC_FLAG_UBLE\n");
-            exit(1);
+        error_report("PowerPC MSR definition inconsistency");
+        error_report_fatal(
+            "Should not define POWERPC_FLAG_SE nor POWERPC_FLAG_DWE nor "
+            "POWERPC_FLAG_UBLE");
     }
     if (env->msr_mask & (1 << 9)) {
         switch (env->flags & (POWERPC_FLAG_BE | POWERPC_FLAG_DE)) {
@@ -8402,14 +8401,14 @@ static void init_ppc_proc(PowerPCCPU *cpu)
         case POWERPC_FLAG_DE:
             break;
         default:
-            fprintf(stderr, "PowerPC MSR definition inconsistency\n"
-                    "Should define POWERPC_FLAG_BE or POWERPC_FLAG_DE\n");
-            exit(1);
+            error_report("PowerPC MSR definition inconsistency");
+            error_report_fatal(
+                "Should define POWERPC_FLAG_BE or POWERPC_FLAG_DE");
         }
     } else if (env->flags & (POWERPC_FLAG_BE | POWERPC_FLAG_DE)) {
-        fprintf(stderr, "PowerPC MSR definition inconsistency\n"
-                "Should not define POWERPC_FLAG_BE nor POWERPC_FLAG_DE\n");
-        exit(1);
+        error_report("PowerPC MSR definition inconsistency");
+        error_report_fatal(
+            "Should not define POWERPC_FLAG_BE nor POWERPC_FLAG_DE");
     }
     if (env->msr_mask & (1 << 2)) {
         switch (env->flags & (POWERPC_FLAG_PX | POWERPC_FLAG_PMM)) {
@@ -8417,19 +8416,19 @@ static void init_ppc_proc(PowerPCCPU *cpu)
         case POWERPC_FLAG_PMM:
             break;
         default:
-            fprintf(stderr, "PowerPC MSR definition inconsistency\n"
-                    "Should define POWERPC_FLAG_PX or POWERPC_FLAG_PMM\n");
-            exit(1);
+            error_report("PowerPC MSR definition inconsistency");
+            error_report_fatal(
+                "Should define POWERPC_FLAG_PX or POWERPC_FLAG_PMM");
         }
     } else if (env->flags & (POWERPC_FLAG_PX | POWERPC_FLAG_PMM)) {
-        fprintf(stderr, "PowerPC MSR definition inconsistency\n"
-                "Should not define POWERPC_FLAG_PX nor POWERPC_FLAG_PMM\n");
-        exit(1);
+        error_report("PowerPC MSR definition inconsistency");
+        error_report_fatal(
+            "Should not define POWERPC_FLAG_PX nor POWERPC_FLAG_PMM");
     }
     if ((env->flags & (POWERPC_FLAG_RTC_CLK | POWERPC_FLAG_BUS_CLK)) == 0) {
-        fprintf(stderr, "PowerPC flags inconsistency\n"
-                "Should define the time-base and decrementer clock source\n");
-        exit(1);
+        error_report("PowerPC flags inconsistency");
+        error_report_fatal(
+            "Should define the time-base and decrementer clock source");
     }
     /* Allocate TLBs buffer when needed */
 #if !defined(CONFIG_USER_ONLY)
@@ -9655,8 +9654,7 @@ static void ppc_cpu_reset(CPUState *s)
 #if !defined(TARGET_WORDS_BIGENDIAN)
     msr |= (target_ulong)1 << MSR_LE; /* Little-endian user mode */
     if (!((env->msr_mask >> MSR_LE) & 1)) {
-        fprintf(stderr, "Selected CPU does not support little-endian.\n");
-        exit(1);
+        error_report_fatal("Selected CPU does not support little-endian.");
     }
 #endif
 #endif

  parent reply	other threads:[~2016-02-02 16:14 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-02 16:13 [Qemu-devel] [RFC][PATCH v6 0/5] utils: Improve and document error reporting Lluís Vilanova
2016-02-02 16:13 ` [Qemu-devel] [PATCH v6 1/5] util: Introduce error reporting functions with fatal/abort Lluís Vilanova
2016-02-02 18:53   ` Markus Armbruster
2016-02-02 21:47     ` Thomas Huth
2016-02-03  5:04       ` David Gibson
2016-02-03  9:48         ` Markus Armbruster
2016-02-03  9:58           ` Thomas Huth
2016-02-03 10:38             ` Markus Armbruster
2016-02-03 13:42               ` Lluís Vilanova
2016-02-03 14:34                 ` Markus Armbruster
2016-02-03 15:11                   ` Lluís Vilanova
2016-02-03 18:06                     ` Markus Armbruster
2016-02-03 22:23           ` David Gibson
2016-02-03  7:26       ` Markus Armbruster
2016-02-03 17:59     ` Lluís Vilanova
2016-02-02 16:14 ` [Qemu-devel] [PATCH v6 2/5] util: Use new error_report_fatal/abort instead of error_setg(&error_fatal/abort) Lluís Vilanova
2016-02-02 20:16   ` John Snow
2016-02-02 16:14 ` Lluís Vilanova [this message]
2016-02-02 16:14 ` [Qemu-devel] [PATCH v6 4/5] util: [ppc] Use new error_report_abort() instead of abort() Lluís Vilanova
2016-02-02 19:34   ` Eric Blake
2016-02-03  5:06   ` David Gibson
2016-02-02 16:14 ` [Qemu-devel] [PATCH v6 5/5] doc: Introduce coding style for errors Lluís Vilanova
2016-02-02 19:10   ` Markus Armbruster
2016-02-03 13:47     ` Lluís Vilanova
2016-02-03 14:41       ` Markus Armbruster
2016-02-03 15:17         ` Lluís Vilanova
2016-02-03 15:53           ` Markus Armbruster
2016-02-03 16:58   ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=145442964969.1539.18333489538497601029.stgit@localhost \
    --to=vilanova@ac.upc.edu \
    --cc=agraf@suse.de \
    --cc=armbru@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=dgilbert@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=stefanha@gmail.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).