From patchwork Fri Apr 8 20:50:49 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Blue Swirl X-Patchwork-Id: 90423 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 2C87DB6EEC for ; Sat, 9 Apr 2011 07:06:08 +1000 (EST) Received: from localhost ([127.0.0.1]:52332 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q8IsM-0003J6-57 for incoming@patchwork.ozlabs.org; Fri, 08 Apr 2011 17:05:54 -0400 Received: from [140.186.70.92] (port=51606 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q8IeU-0004Gw-Ul for qemu-devel@nongnu.org; Fri, 08 Apr 2011 16:51:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q8Ie6-0001p3-06 for qemu-devel@nongnu.org; Fri, 08 Apr 2011 16:51:12 -0400 Received: from mail-vx0-f173.google.com ([209.85.220.173]:50079) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q8Ie5-0001oe-Ms for qemu-devel@nongnu.org; Fri, 08 Apr 2011 16:51:09 -0400 Received: by vxb41 with SMTP id 41so3425280vxb.4 for ; Fri, 08 Apr 2011 13:51:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:from:date:message-id:subject:to :content-type; bh=I6XYpxv1y3LqRECcY237GoIYOVVQq1qwxA3BymhBiKc=; b=tNL5dk0YrTvlBbwuMvij+ZR4QPI43Pb3S/sazpd8Q6FabIDWfTtcBlvJwg7XtRmVR+ qAOjs1L/kQihXVkvYb7v3vi/7x6qLg1bAj8oKT8s7EtXLbNlG5o9CAAddNyYL9gidy1q CbKz2BncryOHqPqHB2VMgIEGuCYeYHRbTZUAo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=d7xCKkXuxyFiwDv1fbjmqiqoUsABogLSd8c2BonzuoDWT7r+OdRJN5yLOVSlbhYB02 Ql/1WRgEpetjX1Yddf72flCHKc/uH96rwSJUcElz3XNyryrqmXig0JiVLrZq+GWZ/TY9 vuv6WkwBR4GG6RQdbpnIHM1+zEdwqPkbhxE4Y= Received: by 10.220.201.138 with SMTP id fa10mr740456vcb.189.1302295869171; Fri, 08 Apr 2011 13:51:09 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.178.70 with HTTP; Fri, 8 Apr 2011 13:50:49 -0700 (PDT) From: Blue Swirl Date: Fri, 8 Apr 2011 23:50:49 +0300 Message-ID: To: qemu-devel X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.220.173 Subject: [Qemu-devel] [PATCH 11/11] Introduce CPU state X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 From 3643ed853bebcb434316a802c7362111c894e4d9 Mon Sep 17 00:00:00 2001 Message-Id: <3643ed853bebcb434316a802c7362111c894e4d9.1302295418.git.blauwirbel@gmail.com> In-Reply-To: <6a1748c587d34b0ce37488596c68c4aee58a4638.1302295418.git.blauwirbel@gmail.com> References: <6a1748c587d34b0ce37488596c68c4aee58a4638.1302295418.git.blauwirbel@gmail.com> 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 . */ +#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 #include "config-host.h" #include "qemu-queue.h" +#include "cpus.h" #ifdef CONFIG_KVM #include 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 #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