From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KCKkA-0003LF-1f for qemu-devel@nongnu.org; Fri, 27 Jun 2008 16:40:30 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KCKk9-0003Ks-Hz for qemu-devel@nongnu.org; Fri, 27 Jun 2008 16:40:29 -0400 Received: from [199.232.76.173] (port=51166 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KCKk9-0003Kb-55 for qemu-devel@nongnu.org; Fri, 27 Jun 2008 16:40:29 -0400 Received: from mx1.redhat.com ([66.187.233.31]:55991) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KCKk9-00082q-Fq for qemu-devel@nongnu.org; Fri, 27 Jun 2008 16:40:29 -0400 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id m5RKeSET014655 for ; Fri, 27 Jun 2008 16:40:28 -0400 Received: from pobox-2.corp.redhat.com (pobox-2.corp.redhat.com [10.11.255.15]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m5RKeNsn006086 for ; Fri, 27 Jun 2008 16:40:23 -0400 Received: from localhost.localdomain (vpn-4-80.str.redhat.com [10.32.4.80]) by pobox-2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m5RKdadr004563 for ; Fri, 27 Jun 2008 16:40:21 -0400 From: Glauber Costa Date: Fri, 27 Jun 2008 17:38:22 -0300 Message-Id: <1214599103-13846-20-git-send-email-gcosta@redhat.com> In-Reply-To: <1214599103-13846-19-git-send-email-gcosta@redhat.com> References: <1214599103-13846-1-git-send-email-gcosta@redhat.com> <1214599103-13846-2-git-send-email-gcosta@redhat.com> <1214599103-13846-3-git-send-email-gcosta@redhat.com> <1214599103-13846-4-git-send-email-gcosta@redhat.com> <1214599103-13846-5-git-send-email-gcosta@redhat.com> <1214599103-13846-6-git-send-email-gcosta@redhat.com> <1214599103-13846-7-git-send-email-gcosta@redhat.com> <1214599103-13846-8-git-send-email-gcosta@redhat.com> <1214599103-13846-9-git-send-email-gcosta@redhat.com> <1214599103-13846-10-git-send-email-gcosta@redhat.com> <1214599103-13846-11-git-send-email-gcosta@redhat.com> <1214599103-13846-12-git-send-email-gcosta@redhat.com> <1214599103-13846-13-git-send-email-gcosta@redhat.com> <1214599103-13846-14-git-send-email-gcosta@redhat.com> <1214599103-13846-15-git-send-email-gcosta@redhat.com> <1214599103-13846-16-git-send-email-gcosta@redhat.com> <1214599103-13846-17-git-send-email-gcosta@redhat.com> <1214599103-13846-18-git-send-email-gcosta@redhat.com> <1214599103-13846-19-git-send-email-gcosta@redhat.com> Subject: [Qemu-devel] [PATCH 19/20] get_env accel wrapper Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Allow the current accelerator to provide it's own, customized address of the CPUState structure used for the env variable. Signed-off-by: Glauber Costa --- accel.h | 8 ++++++++ target-i386/helper.c | 2 +- 2 files changed, 9 insertions(+), 1 deletions(-) diff --git a/accel.h b/accel.h index 52b95e4..08ad337 100644 --- a/accel.h +++ b/accel.h @@ -1,6 +1,7 @@ typedef struct QEMUAccel { char *name; void (*cpu_interrupt)(CPUState *env); + CPUState *(*get_env)(void); void (*init_env)(CPUState *env); int (*start)(void); void (*flush_cache)(CPUState *env, int global); @@ -76,6 +77,13 @@ static inline void accel_start(void) } } +static inline CPUState *accel_get_env(void) +{ + if (current_accel && current_accel->get_env) + return current_accel->get_env(); + return qemu_mallocz(sizeof(CPUState)); +} + static inline void accel_init_env(CPUState *env) { if (current_accel && current_accel->init_env) diff --git a/target-i386/helper.c b/target-i386/helper.c index 4febc45..9bb726f 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -98,7 +98,7 @@ CPUX86State *cpu_x86_init(const char *cpu_model) CPUX86State *env; static int inited; - env = qemu_mallocz(sizeof(CPUX86State)); + env = accel_get_env(); if (!env) return NULL; cpu_exec_init(env); -- 1.5.5.1