From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Claudio Fontana" <cfontana@suse.de>,
"Richard Henderson" <rth@twiddle.net>
Subject: [PATCH 2/2] hw/core: Move hw_error() out of cpus.c
Date: Tue, 1 Sep 2020 13:23:23 +0200 [thread overview]
Message-ID: <20200901112323.94969-3-f4bug@amsat.org> (raw)
In-Reply-To: <20200901112323.94969-1-f4bug@amsat.org>
As hw_error() is unrelated to CPU error - for which we have
cpu_abort() - move it out of cpus.c, under the hw/ directory.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
Couldn't find better file/name to put it in...
---
hw/core/error.c | 38 ++++++++++++++++++++++++++++++++++++++
softmmu/cpus.c | 12 ------------
hw/core/meson.build | 1 +
3 files changed, 39 insertions(+), 12 deletions(-)
create mode 100644 hw/core/error.c
diff --git a/hw/core/error.c b/hw/core/error.c
new file mode 100644
index 00000000000..5a783c82dff
--- /dev/null
+++ b/hw/core/error.c
@@ -0,0 +1,38 @@
+/*
+ * Peripheral error reporting
+ *
+ * Copyright (c) 2003-2008 Fabrice Bellard
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "qemu/osdep.h"
+#include "hw/hw.h"
+
+void hw_error(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ fprintf(stderr, "qemu: hardware error: ");
+ vfprintf(stderr, fmt, ap);
+ fprintf(stderr, "\n");
+ va_end(ap);
+ abort();
+}
diff --git a/softmmu/cpus.c b/softmmu/cpus.c
index c96a04d7f18..eca57c76c9b 100644
--- a/softmmu/cpus.c
+++ b/softmmu/cpus.c
@@ -59,7 +59,6 @@
#include "sysemu/replay.h"
#include "sysemu/runstate.h"
#include "hw/boards.h"
-#include "hw/hw.h"
#include "sysemu/cpu-throttle.h"
@@ -910,17 +909,6 @@ static void stop_tcg_kick_timer(void)
}
/***********************************************************/
-void hw_error(const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- fprintf(stderr, "qemu: hardware error: ");
- vfprintf(stderr, fmt, ap);
- fprintf(stderr, "\n");
- va_end(ap);
- abort();
-}
void cpu_synchronize_all_states(void)
{
diff --git a/hw/core/meson.build b/hw/core/meson.build
index fc91f980758..99466dc93fd 100644
--- a/hw/core/meson.build
+++ b/hw/core/meson.build
@@ -1,6 +1,7 @@
# core qdev-related obj files, also used by *-user and unit tests
hwcore_files = files(
'bus.c',
+ 'error.c',
'fw-path-provider.c',
'hotplug.c',
'qdev-properties.c',
--
2.26.2
next prev parent reply other threads:[~2020-09-01 11:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-01 11:23 [PATCH 0/2] hw/core: Move hw_error() out of cpus.c Philippe Mathieu-Daudé
2020-09-01 11:23 ` [PATCH 1/2] cpus: Do not dump CPU state when calling hw_error() Philippe Mathieu-Daudé
2020-09-02 6:33 ` Thomas Huth
2020-09-02 16:04 ` Philippe Mathieu-Daudé
2020-09-01 11:23 ` Philippe Mathieu-Daudé [this message]
2020-09-02 6:37 ` [PATCH 2/2] hw/core: Move hw_error() out of cpus.c Thomas Huth
2020-09-02 15:38 ` Richard Henderson
2020-09-02 15:59 ` Philippe Mathieu-Daudé
2020-09-02 16:02 ` Thomas Huth
2020-09-02 16:13 ` Philippe Mathieu-Daudé
2020-09-01 16:44 ` [PATCH 0/2] " Richard Henderson
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=20200901112323.94969-3-f4bug@amsat.org \
--to=f4bug@amsat.org \
--cc=cfontana@suse.de \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--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).