[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v7 05/23] cpu: Split as cpu-common / cpu-sysemu
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v7 05/23] cpu: Split as cpu-common / cpu-sysemu |
Date: |
Mon, 17 May 2021 12:51:22 +0200 |
The current cpu.c contains sysemu-specific methods.
To avoid building them in user-mode builds, split the
current cpu.c as cpu-common.c / cpu-sysemu.c.
Start by moving cpu_get_crash_info().
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/core/{cpu.c => cpu-common.c} | 17 -----------------
hw/core/cpu-sysemu.c | 34 +++++++++++++++++++++++++++++++++
hw/core/meson.build | 3 ++-
3 files changed, 36 insertions(+), 18 deletions(-)
rename hw/core/{cpu.c => cpu-common.c} (96%)
create mode 100644 hw/core/cpu-sysemu.c
diff --git a/hw/core/cpu.c b/hw/core/cpu-common.c
similarity index 96%
rename from hw/core/cpu.c
rename to hw/core/cpu-common.c
index 919dc3435a3..ddddf4b10eb 100644
--- a/hw/core/cpu.c
+++ b/hw/core/cpu-common.c
@@ -190,23 +190,6 @@ static bool cpu_common_virtio_is_big_endian(CPUState *cpu)
return target_words_bigendian();
}
-/*
- * XXX the following #if is always true because this is a common_ss
- * module, so target CONFIG_* is never defined.
- */
-#if !defined(CONFIG_USER_ONLY)
-GuestPanicInformation *cpu_get_crash_info(CPUState *cpu)
-{
- CPUClass *cc = CPU_GET_CLASS(cpu);
- GuestPanicInformation *res = NULL;
-
- if (cc->get_crash_info) {
- res = cc->get_crash_info(cpu);
- }
- return res;
-}
-#endif
-
void cpu_dump_state(CPUState *cpu, FILE *f, int flags)
{
CPUClass *cc = CPU_GET_CLASS(cpu);
diff --git a/hw/core/cpu-sysemu.c b/hw/core/cpu-sysemu.c
new file mode 100644
index 00000000000..f517ef5d460
--- /dev/null
+++ b/hw/core/cpu-sysemu.c
@@ -0,0 +1,34 @@
+/*
+ * QEMU CPU model (system emulation specific)
+ *
+ * Copyright (c) 2012-2014 SUSE LINUX Products GmbH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see
+ * <http://www.gnu.org/licenses/gpl-2.0.html>
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "hw/core/cpu.h"
+
+GuestPanicInformation *cpu_get_crash_info(CPUState *cpu)
+{
+ CPUClass *cc = CPU_GET_CLASS(cpu);
+ GuestPanicInformation *res = NULL;
+
+ if (cc->get_crash_info) {
+ res = cc->get_crash_info(cpu);
+ }
+ return res;
+}
diff --git a/hw/core/meson.build b/hw/core/meson.build
index 59f1605bb07..18f44fb7c24 100644
--- a/hw/core/meson.build
+++ b/hw/core/meson.build
@@ -13,7 +13,7 @@
'qdev-clock.c',
)
-common_ss.add(files('cpu.c'))
+common_ss.add(files('cpu-common.c'))
common_ss.add(when: 'CONFIG_FITLOADER', if_true: files('loader-fit.c'))
common_ss.add(when: 'CONFIG_GENERIC_LOADER', if_true:
files('generic-loader.c'))
common_ss.add(when: ['CONFIG_GUEST_LOADER', fdt], if_true:
files('guest-loader.c'))
@@ -25,6 +25,7 @@
common_ss.add(when: 'CONFIG_XILINX_AXI', if_true: files('stream.c'))
softmmu_ss.add(files(
+ 'cpu-sysemu.c',
'fw-path-provider.c',
'loader.c',
'machine-hmp-cmds.c',
--
2.26.3
- [PATCH v7 00/23] cpu: Introduce SysemuCPUOps structure, Philippe Mathieu-Daudé, 2021/05/17
- [PATCH v7 03/23] cpu: Restrict target cpu_do_unaligned_access() handlers to sysemu, Philippe Mathieu-Daudé, 2021/05/17
- [PATCH v7 04/23] cpu: Remove duplicated 'sysemu/hw_accel.h' header, Philippe Mathieu-Daudé, 2021/05/17
- [PATCH v7 05/23] cpu: Split as cpu-common / cpu-sysemu,
Philippe Mathieu-Daudé <=
- [PATCH v7 06/23] cpu: Un-inline cpu_get_phys_page_debug and cpu_asidx_from_attrs, Philippe Mathieu-Daudé, 2021/05/17
- [PATCH v7 07/23] cpu: Introduce cpu_virtio_is_big_endian(), Philippe Mathieu-Daudé, 2021/05/17
- [PATCH v7 08/23] cpu: Directly use cpu_write_elf*() fallback handlers in place, Philippe Mathieu-Daudé, 2021/05/17
- [PATCH v7 09/23] cpu: Directly use get_paging_enabled() fallback handlers in place, Philippe Mathieu-Daudé, 2021/05/17
- [PATCH v7 10/23] cpu: Directly use get_memory_mapping() fallback handlers in place, Philippe Mathieu-Daudé, 2021/05/17
- [PATCH v7 11/23] cpu: Assert DeviceClass::vmsd is NULL on user emulation, Philippe Mathieu-Daudé, 2021/05/17
- [PATCH v7 12/23] cpu: Rename CPUClass vmsd -> legacy_vmsd, Philippe Mathieu-Daudé, 2021/05/17
- [PATCH v7 13/23] cpu: Move AVR target vmsd field from CPUClass to DeviceClass, Philippe Mathieu-Daudé, 2021/05/17