From patchwork Mon Feb 28 09:10:12 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 84774 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 34C301007D5 for ; Mon, 28 Feb 2011 21:42:17 +1100 (EST) Received: from localhost ([127.0.0.1]:39609 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pu0YQ-0004EK-7c for incoming@patchwork.ozlabs.org; Mon, 28 Feb 2011 05:42:14 -0500 Received: from [140.186.70.92] (port=39178 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PtzEj-0003Ez-8I for qemu-devel@nongnu.org; Mon, 28 Feb 2011 04:17:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ptz8A-0004ib-JH for qemu-devel@nongnu.org; Mon, 28 Feb 2011 04:11:04 -0500 Received: from mail-gw0-f46.google.com ([74.125.83.46]:59699) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ptz8A-0004iR-BW for qemu-devel@nongnu.org; Mon, 28 Feb 2011 04:11:02 -0500 Received: by gwj20 with SMTP id 20so2189656gwj.33 for ; Mon, 28 Feb 2011 01:11:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:from:to:cc:subject:date:message-id :x-mailer:in-reply-to:references; bh=AR4abonZnD18QB7lKZLEog5+D+lAoUswqAK5oERhiuA=; b=KJ/RwjN5DNopfJ6cEqVl0YuPZvzGA4Ac7ekS/GnMWvVR/MwRDAKl/Fsfg2Uvx97xOS ZylJSxQzaWqLAQMMjz7iBz9TT0zihxhrOKNzKAxxgmJk0Af+XQh1mUdbyea2MbTU1AWZ mORFC6CPt4gYl79E6UxpQWVBdGJW2MUABTG8U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; b=YROXb7B+r+ClQ5FugWosNSghYz7i3SeCUfFpdCG53/hg4Yu/iUfkNvRbzeXfJHE+xp fC77ttidmucyht/BL1pKnvW0jP+h5k8/9lTGGI8wlntPo0a6uhyGt44aQGXzVW5yJinZ IFA19Dtvd9MVGsWzb2ovaZePyNpiY9ic12FpE= Received: by 10.236.111.17 with SMTP id v17mr9303181yhg.4.1298884261980; Mon, 28 Feb 2011 01:11:01 -0800 (PST) Received: from localhost.localdomain (93-34-149-100.ip50.fastwebnet.it [93.34.149.100]) by mx.google.com with ESMTPS id 1sm2037209yhl.11.2011.02.28.01.11.00 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 28 Feb 2011 01:11:01 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 28 Feb 2011 10:10:12 +0100 Message-Id: <1298884224-19734-11-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.4 In-Reply-To: <1298884224-19734-1-git-send-email-pbonzini@redhat.com> References: <1298884224-19734-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 74.125.83.46 Cc: blauwirbel@gmail.com, jan.kiszka@siemes.com, aurelien@aurel32.net, kvm@vger.kernel.org, mtosatti@redhat.com Subject: [Qemu-devel] [PATCH v3 uq/master 10/22] inline cpu_halted into sole caller 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 All implementations are now the same, and there is only one caller, so inline the function there. Signed-off-by: Paolo Bonzini --- cpu-exec.c | 9 +++++++-- target-alpha/exec.h | 11 ----------- target-arm/exec.h | 13 ------------- target-cris/exec.h | 11 ----------- target-i386/exec.h | 12 ------------ target-m68k/exec.h | 10 ---------- target-microblaze/exec.h | 11 ----------- target-mips/exec.h | 11 ----------- target-ppc/exec.h | 11 ----------- target-s390x/exec.h | 12 ------------ target-sh4/exec.h | 10 ---------- target-sparc/exec.h | 10 ---------- 12 files changed, 7 insertions(+), 124 deletions(-) diff --git a/cpu-exec.c b/cpu-exec.c index b03b3a7..eed9282 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -208,8 +208,13 @@ int cpu_exec(CPUState *env1) uint8_t *tc_ptr; unsigned long next_tb; - if (cpu_halted(env1) == EXCP_HALTED) - return EXCP_HALTED; + if (env1->halted) { + if (!cpu_has_work(env1)) { + return EXCP_HALTED; + } + + env1->halted = 0; + } cpu_single_env = env1; diff --git a/target-alpha/exec.h b/target-alpha/exec.h index a8a38d2..6ae96d1 100644 --- a/target-alpha/exec.h +++ b/target-alpha/exec.h @@ -42,17 +42,6 @@ static inline int cpu_has_work(CPUState *env) return (env->interrupt_request & CPU_INTERRUPT_HARD); } -static inline int cpu_halted(CPUState *env) -{ - if (!env->halted) - return 0; - if (cpu_has_work(env)) { - env->halted = 0; - return 0; - } - return EXCP_HALTED; -} - static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb) { env->pc = tb->pc; diff --git a/target-arm/exec.h b/target-arm/exec.h index e4c35a3..44e1b55 100644 --- a/target-arm/exec.h +++ b/target-arm/exec.h @@ -32,19 +32,6 @@ static inline int cpu_has_work(CPUState *env) (CPU_INTERRUPT_FIQ | CPU_INTERRUPT_HARD | CPU_INTERRUPT_EXITTB)); } -static inline int cpu_halted(CPUState *env) { - if (!env->halted) - return 0; - /* An interrupt wakes the CPU even if the I and F CPSR bits are - set. We use EXITTB to silently wake CPU without causing an - actual interrupt. */ - if (cpu_has_work(env)) { - env->halted = 0; - return 0; - } - return EXCP_HALTED; -} - #if !defined(CONFIG_USER_ONLY) #include "softmmu_exec.h" #endif diff --git a/target-cris/exec.h b/target-cris/exec.h index 34c0132..2d5d297 100644 --- a/target-cris/exec.h +++ b/target-cris/exec.h @@ -33,17 +33,6 @@ static inline int cpu_has_work(CPUState *env) return (env->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_NMI)); } -static inline int cpu_halted(CPUState *env) { - if (!env->halted) - return 0; - - if (cpu_has_work(env)) { - env->halted = 0; - return 0; - } - return EXCP_HALTED; -} - static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb) { env->pc = tb->pc; diff --git a/target-i386/exec.h b/target-i386/exec.h index fc8945b..3e7386e 100644 --- a/target-i386/exec.h +++ b/target-i386/exec.h @@ -304,18 +304,6 @@ static inline int cpu_has_work(CPUState *env) return work; } -static inline int cpu_halted(CPUState *env) { - /* handle exit of HALTED state */ - if (!env->halted) - return 0; - /* disable halt condition */ - if (cpu_has_work(env)) { - env->halted = 0; - return 0; - } - return EXCP_HALTED; -} - /* load efer and update the corresponding hflags. XXX: do consistency checks with cpuid bits ? */ static inline void cpu_load_efer(CPUState *env, uint64_t val) diff --git a/target-m68k/exec.h b/target-m68k/exec.h index f31e06e..91daa6b 100644 --- a/target-m68k/exec.h +++ b/target-m68k/exec.h @@ -33,16 +33,6 @@ static inline int cpu_has_work(CPUState *env) return (env->interrupt_request & (CPU_INTERRUPT_HARD)); } -static inline int cpu_halted(CPUState *env) { - if (!env->halted) - return 0; - if (cpu_has_work(env)) { - env->halted = 0; - return 0; - } - return EXCP_HALTED; -} - static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb) { env->pc = tb->pc; diff --git a/target-microblaze/exec.h b/target-microblaze/exec.h index ab19828..1efff30 100644 --- a/target-microblaze/exec.h +++ b/target-microblaze/exec.h @@ -32,17 +32,6 @@ static inline int cpu_has_work(CPUState *env) return (env->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_NMI)); } -static inline int cpu_halted(CPUState *env) { - if (!env->halted) - return 0; - - if (cpu_has_work(env)) { - env->halted = 0; - return 0; - } - return EXCP_HALTED; -} - static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb) { env->sregs[SR_PC] = tb->pc; diff --git a/target-mips/exec.h b/target-mips/exec.h index 1273654..b3c5a13 100644 --- a/target-mips/exec.h +++ b/target-mips/exec.h @@ -36,17 +36,6 @@ static inline int cpu_has_work(CPUState *env) return has_work; } -static inline int cpu_halted(CPUState *env) -{ - if (!env->halted) - return 0; - if (cpu_has_work(env)) { - env->halted = 0; - return 0; - } - return EXCP_HALTED; -} - static inline void compute_hflags(CPUState *env) { env->hflags &= ~(MIPS_HFLAG_COP1X | MIPS_HFLAG_64 | MIPS_HFLAG_CP0 | diff --git a/target-ppc/exec.h b/target-ppc/exec.h index 4688ef5..f87847a 100644 --- a/target-ppc/exec.h +++ b/target-ppc/exec.h @@ -38,17 +38,6 @@ static inline int cpu_has_work(CPUState *env) } -static inline int cpu_halted(CPUState *env) -{ - if (!env->halted) - return 0; - if (cpu_has_work(env)) { - env->halted = 0; - return 0; - } - return EXCP_HALTED; -} - static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb) { env->nip = tb->pc; diff --git a/target-s390x/exec.h b/target-s390x/exec.h index bf3f264..f7893f3 100644 --- a/target-s390x/exec.h +++ b/target-s390x/exec.h @@ -34,18 +34,6 @@ static inline int cpu_has_work(CPUState *env) return env->interrupt_request & CPU_INTERRUPT_HARD; // guess } -static inline int cpu_halted(CPUState *env) -{ - if (!env->halted) { - return 0; - } - if (cpu_has_work(env)) { - env->halted = 0; - return 0; - } - return EXCP_HALTED; -} - static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock* tb) { env->psw.addr = tb->pc; diff --git a/target-sh4/exec.h b/target-sh4/exec.h index 61bc121..9f1c1f6 100644 --- a/target-sh4/exec.h +++ b/target-sh4/exec.h @@ -32,16 +32,6 @@ static inline int cpu_has_work(CPUState *env) return (env->interrupt_request & CPU_INTERRUPT_HARD); } -static inline int cpu_halted(CPUState *env) { - if (!env->halted) - return 0; - if (cpu_has_work(env)) { - env->halted = 0; - return 0; - } - return EXCP_HALTED; -} - #ifndef CONFIG_USER_ONLY #include "softmmu_exec.h" #endif diff --git a/target-sparc/exec.h b/target-sparc/exec.h index f811571..f5c221e 100644 --- a/target-sparc/exec.h +++ b/target-sparc/exec.h @@ -22,16 +22,6 @@ static inline int cpu_has_work(CPUState *env1) } -static inline int cpu_halted(CPUState *env1) { - if (!env1->halted) - return 0; - if (cpu_has_work(env1)) { - env1->halted = 0; - return 0; - } - return EXCP_HALTED; -} - static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb) { env->pc = tb->pc;