From 3643ed853bebcb434316a802c7362111c894e4d9 Mon Sep 17 00:00:00 2001 Message-Id:
In-Reply-To: References: From: Blue Swirl Date: Fri, 8 Apr 2011 19:59:13 +0000 Subject: [PATCH 11/11] Introduce CPU state WIP Signed-off-by: Blue Swirl --- 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