From patchwork Mon Feb 28 09:10:11 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 84767 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 08811B7145 for ; Mon, 28 Feb 2011 21:21:44 +1100 (EST) Received: from localhost ([127.0.0.1]:49633 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pu0EX-0002mf-8z for incoming@patchwork.ozlabs.org; Mon, 28 Feb 2011 05:21:41 -0500 Received: from [140.186.70.92] (port=45374 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PtzEd-0005xo-KP for qemu-devel@nongnu.org; Mon, 28 Feb 2011 04:17:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PtzAh-00054S-8q for qemu-devel@nongnu.org; Mon, 28 Feb 2011 04:13:40 -0500 Received: from mail-gw0-f46.google.com ([74.125.83.46]:40331) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PtzAh-00054M-6G for qemu-devel@nongnu.org; Mon, 28 Feb 2011 04:13:39 -0500 Received: by gwj20 with SMTP id 20so2190687gwj.33 for ; Mon, 28 Feb 2011 01:13:38 -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=Ea1fFPtoTFxoEW0DqY2k7GqsPGd6LlGOlgzT5QQkdKw=; b=TLEMYa6fyaCnDquAtU0a6sgY0Zg0Pk/kazZqYFWloSn/DV8oAqAD9ggDWUui+0xDo2 3lc+v7ODaSx0QrVeTQAhPg8zZQPFlAJ1jU1avxeywj4Y6G257JHm6clTpYiRfntjjIpm d3s5CAkDzV8uVieVCm8OjwgbW6pJ3h0Dc7epg= 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=LuUPyzOEGNwnxHKoPjPia0kSbOUt6o2sG7NsbwSIGDbXaS32O1XdKoo7ZLwIALLXir 6EIC+yR8rsOjIPWYNQ+/H1LtAnNmSmcnB9rfWJINQ/I9SeU42JquFNAKYqba3dNut+9K cGqIQ6QIY3dYFCUCEubRrMYe0MNERMxjBDHCg= Received: by 10.236.5.145 with SMTP id 17mr2065700yhl.3.1298884260032; Mon, 28 Feb 2011 01:11:00 -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.10.57 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 28 Feb 2011 01:10:59 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 28 Feb 2011 10:10:11 +0100 Message-Id: <1298884224-19734-10-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 09/22] target-sh4: move intr_at_halt out of cpu_halted() 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 From: Aurelien Jarno All targets except SH4 have the same cpu_halted() routine, and it has only one caller. It is therefore a good candidate for inlining. The difference is the handling of the intr_at_halt, which is necessary to ignore SR.BL when sleeping. Move intr_at_halt handling out of it, by setting this variable while executing the sleep instruction, and clearing it when the CPU has been woken-up by an interrupt, whatever the state of SR.BL. Also rename this variable in_sleep. Cc: Paolo Bonzini Signed-off-by: Aurelien Jarno --- target-sh4/cpu.h | 2 +- target-sh4/exec.h | 1 - target-sh4/helper.c | 4 ++-- target-sh4/op_helper.c | 1 + 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/target-sh4/cpu.h b/target-sh4/cpu.h index 789d188..74ff97a 100644 --- a/target-sh4/cpu.h +++ b/target-sh4/cpu.h @@ -184,7 +184,7 @@ typedef struct CPUSH4State { uint32_t cvr; /* Cache Version Register */ void *intc_handle; - int intr_at_halt; /* SR_BL ignored during sleep */ + int in_sleep; /* SR_BL ignored during sleep */ memory_content *movcal_backup; memory_content **movcal_backup_tail; } CPUSH4State; diff --git a/target-sh4/exec.h b/target-sh4/exec.h index 2999c02..61bc121 100644 --- a/target-sh4/exec.h +++ b/target-sh4/exec.h @@ -37,7 +37,6 @@ static inline int cpu_halted(CPUState *env) { return 0; if (cpu_has_work(env)) { env->halted = 0; - env->intr_at_halt = 1; return 0; } return EXCP_HALTED; diff --git a/target-sh4/helper.c b/target-sh4/helper.c index d2038bd..8f36d31 100644 --- a/target-sh4/helper.c +++ b/target-sh4/helper.c @@ -90,11 +90,11 @@ void do_interrupt(CPUState * env) if (do_exp && env->exception_index != 0x1e0) { env->exception_index = 0x000; /* masked exception -> reset */ } - if (do_irq && !env->intr_at_halt) { + if (do_irq && !env->in_sleep) { return; /* masked */ } - env->intr_at_halt = 0; } + env->in_sleep = 0; if (do_irq) { irq_vector = sh_intc_get_pending_vector(env->intc_handle, diff --git a/target-sh4/op_helper.c b/target-sh4/op_helper.c index 30f9842..b8f4ca2 100644 --- a/target-sh4/op_helper.c +++ b/target-sh4/op_helper.c @@ -119,6 +119,7 @@ void helper_debug(void) void helper_sleep(uint32_t next_pc) { env->halted = 1; + env->in_sleep = 1; env->exception_index = EXCP_HLT; env->pc = next_pc; cpu_loop_exit();