[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 11/11] Introduce CPU state
From: |
Blue Swirl |
Subject: |
[Qemu-devel] [PATCH 11/11] Introduce CPU state |
Date: |
Fri, 8 Apr 2011 23:50:49 +0300 |
WIP
Signed-off-by: Blue Swirl <address@hidden>
---
cpu-all.h | 1 +
cpu-state.h | 8 ++++++++
cpus.h | 38 ++++++++++++++++++++++++++++++++++++++
gdbstub.h | 1 +
hw/hw.h | 1 +
hw/omap.h | 2 ++
hw/smbios.c | 1 +
hw/soc_dma.h | 2 ++
hw/sun4m.h | 2 +-
kvm.h | 1 +
qemu-common.h | 26 --------------------------
qemu-timer.h | 17 -----------------
scripts/feature_to_c.sh | 2 +-
13 files changed, 57 insertions(+), 45 deletions(-)
create mode 100644 cpu-state.h
diff --git a/cpu-all.h b/cpu-all.h
index dc0f2f0..f74be40 100644
--- a/cpu-all.h
+++ b/cpu-all.h
@@ -20,6 +20,7 @@
#define CPU_ALL_H
#include "qemu-common.h"
+#include "cpus.h"
#include "cpu-common.h"
/* some important defines:
diff --git a/cpu-state.h b/cpu-state.h
new file mode 100644
index 0000000..baecb54
--- /dev/null
+++ b/cpu-state.h
@@ -0,0 +1,8 @@
+#ifndef QEMU_CPU_STATE_H
+#define QEMU_CPU_STATE_H
+/*
+ * CPU state: All generic state related to CPU emulation.
+ */
+
+
+#endif
diff --git a/cpus.h b/cpus.h
index 6fdeb0d..5c2ea73 100644
--- a/cpus.h
+++ b/cpus.h
@@ -1,6 +1,11 @@
#ifndef QEMU_CPUS_H
#define QEMU_CPUS_H
+/* FIXME: Remove NEED_CPU_H. */
+#ifdef NEED_CPU_H
+#include "cpu.h"
+#endif /* !defined(NEED_CPU_H) */
+
/* cpus.c */
int qemu_init_main_loop(void);
void qemu_main_loop_start(void);
@@ -21,4 +26,37 @@ void set_numa_modes(void);
void set_cpu_log(const char *optarg);
void list_cpus(FILE *f, fprintf_function cpu_fprintf, const char *optarg);
+void cpu_exec_init_all(unsigned long tb_size);
+
+/* CPU save/load. */
+void cpu_save(QEMUFile *f, void *opaque);
+int cpu_load(QEMUFile *f, void *opaque, int version_id);
+
+/* Unblock cpu */
+void qemu_cpu_kick(void *env1);
+void qemu_cpu_kick_self(void);
+int qemu_cpu_is_self(void *env1);
+
+#ifdef CONFIG_USER_ONLY
+#define qemu_init_vcpu(env) do { } while (0)
+#else
+void qemu_init_vcpu(void *env1);
+#endif
+
+extern int use_icount;
+#ifdef NEED_CPU_H
+/* Deterministic execution requires that IO only be performed on the last
+ instruction of a TB so that interrupts take effect immediately. */
+static inline int can_do_io(CPUState *env)
+{
+ if (!use_icount)
+ return 1;
+
+ /* If not executing code then assume we are ok. */
+ if (!env->current_tb)
+ return 1;
+
+ return env->can_do_io != 0;
+}
+#endif
#endif
diff --git a/gdbstub.h b/gdbstub.h
index d82334f..1ed14e7 100644
--- a/gdbstub.h
+++ b/gdbstub.h
@@ -1,6 +1,7 @@
#ifndef GDBSTUB_H
#define GDBSTUB_H
+#include "cpus.h"
#define DEFAULT_GDBSTUB_PORT "1234"
/* GDB breakpoint/watchpoint types */
diff --git a/hw/hw.h b/hw/hw.h
index 1b09039..a68d5ae 100644
--- a/hw/hw.h
+++ b/hw/hw.h
@@ -4,6 +4,7 @@
#include "qemu-common.h"
+#include "cpus.h"
#if defined(TARGET_PHYS_ADDR_BITS) && !defined(NEED_CPU_H)
#include "cpu-common.h"
#endif
diff --git a/hw/omap.h b/hw/omap.h
index c227a82..898cee7 100644
--- a/hw/omap.h
+++ b/hw/omap.h
@@ -19,6 +19,8 @@
#ifndef hw_omap_h
# define hw_omap_h "omap.h"
+#include "cpus.h"
+
# define OMAP_EMIFS_BASE 0x00000000
# define OMAP2_Q0_BASE 0x00000000
# define OMAP_CS0_BASE 0x00000000
diff --git a/hw/smbios.c b/hw/smbios.c
index a3ae1de..62135bb 100644
--- a/hw/smbios.c
+++ b/hw/smbios.c
@@ -11,6 +11,7 @@
*
*/
+#include "hw/hw.h"
#include "sysemu.h"
#include "smbios.h"
#include "loader.h"
diff --git a/hw/soc_dma.h b/hw/soc_dma.h
index c0ebb8d..536473f 100644
--- a/hw/soc_dma.h
+++ b/hw/soc_dma.h
@@ -18,6 +18,8 @@
* with this program; if not, see <http://www.gnu.org/licenses/>.
*/
+#include "hw/hw.h"
+
struct soc_dma_s;
struct soc_dma_ch_s;
typedef void (*soc_dma_io_t)(void *opaque, uint8_t *buf, int len);
diff --git a/hw/sun4m.h b/hw/sun4m.h
index ce97ee5..2eff379 100644
--- a/hw/sun4m.h
+++ b/hw/sun4m.h
@@ -1,7 +1,7 @@
#ifndef SUN4M_H
#define SUN4M_H
-#include "qemu-common.h"
+#include "hw/hw.h"
/* Devices used by sparc32 system. */
diff --git a/kvm.h b/kvm.h
index d565dba..4a5d097 100644
--- a/kvm.h
+++ b/kvm.h
@@ -17,6 +17,7 @@
#include <errno.h>
#include "config-host.h"
#include "qemu-queue.h"
+#include "cpus.h"
#ifdef CONFIG_KVM
#include <linux/kvm.h>
diff --git a/qemu-common.h b/qemu-common.h
index 8b48a09..373d5ee 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -120,19 +120,10 @@ static inline char *realpath(const char *path,
char *resolved_path)
#define PRIo64 "I64o"
#endif
-/* FIXME: Remove NEED_CPU_H. */
-#ifndef NEED_CPU_H
-
#include <setjmp.h>
#include "osdep.h"
#include "bswap.h"
-#else
-
-#include "cpu.h"
-
-#endif /* !defined(NEED_CPU_H) */
-
/* bottom halves */
typedef void QEMUBHFunc(void *opaque);
@@ -293,23 +284,12 @@ typedef struct VirtIODevice VirtIODevice;
typedef uint64_t pcibus_t;
-void cpu_exec_init_all(unsigned long tb_size);
-
-/* CPU save/load. */
-void cpu_save(QEMUFile *f, void *opaque);
-int cpu_load(QEMUFile *f, void *opaque, int version_id);
-
/* Force QEMU to stop what it's doing and service IO */
void qemu_service_io(void);
/* Force QEMU to process pending events */
void qemu_notify_event(void);
-/* Unblock cpu */
-void qemu_cpu_kick(void *env);
-void qemu_cpu_kick_self(void);
-int qemu_cpu_is_self(void *env);
-
/* work queue */
struct qemu_work_item {
struct qemu_work_item *next;
@@ -318,12 +298,6 @@ struct qemu_work_item {
int done;
};
-#ifdef CONFIG_USER_ONLY
-#define qemu_init_vcpu(env) do { } while (0)
-#else
-void qemu_init_vcpu(void *env);
-#endif
-
typedef struct QEMUIOVector {
struct iovec *iov;
int niov;
diff --git a/qemu-timer.h b/qemu-timer.h
index 4738e99..2ad5f0d 100644
--- a/qemu-timer.h
+++ b/qemu-timer.h
@@ -149,7 +149,6 @@ void qemu_get_ptimer(QEMUFile *f, ptimer_state *s);
/* icount */
int64_t qemu_icount_round(int64_t count);
extern int64_t qemu_icount;
-extern int use_icount;
extern int icount_time_shift;
extern int64_t qemu_icount_bias;
int64_t cpu_get_icount(void);
@@ -308,22 +307,6 @@ static inline int64_t cpu_get_real_ticks (void)
}
#endif
-#ifdef NEED_CPU_H
-/* Deterministic execution requires that IO only be performed on the last
- instruction of a TB so that interrupts take effect immediately. */
-static inline int can_do_io(CPUState *env)
-{
- if (!use_icount)
- return 1;
-
- /* If not executing code then assume we are ok. */
- if (!env->current_tb)
- return 1;
-
- return env->can_do_io != 0;
-}
-#endif
-
#ifdef CONFIG_PROFILER
static inline int64_t profile_getclock(void)
{
diff --git a/scripts/feature_to_c.sh b/scripts/feature_to_c.sh
index b62da8a..a958f88 100644
--- a/scripts/feature_to_c.sh
+++ b/scripts/feature_to_c.sh
@@ -37,7 +37,7 @@ for input; do
${AWK:-awk} 'BEGIN { n = 0
printf "#include \"config.h\"\n"
- printf "#include \"qemu-common.h\"\n"
+ printf "#include \"cpus.h\"\n"
printf "#include \"gdbstub.h\"\n"
print "static const char '$arrayname'[] = {"
for (i = 0; i < 255; i++)
--
1.7.2.5
0011-Introduce-CPU-state.patch
Description: Text Data
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] [PATCH 11/11] Introduce CPU state,
Blue Swirl <=