From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NSyy1-0004rp-EB for qemu-devel@nongnu.org; Thu, 07 Jan 2010 15:28:25 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NSyxw-0004mU-Ck for qemu-devel@nongnu.org; Thu, 07 Jan 2010 15:28:24 -0500 Received: from [199.232.76.173] (port=38276 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NSyxw-0004m0-2V for qemu-devel@nongnu.org; Thu, 07 Jan 2010 15:28:20 -0500 Received: from mail-fx0-f222.google.com ([209.85.220.222]:33820) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NSyxu-0000ti-Du for qemu-devel@nongnu.org; Thu, 07 Jan 2010 15:28:19 -0500 Received: by mail-fx0-f222.google.com with SMTP id 22so21243905fxm.2 for ; Thu, 07 Jan 2010 12:28:17 -0800 (PST) Received: from localhost ([127.0.0.1] helo=[192.168.1.2]) by skyserv with esmtp (Exim 4.71) (envelope-from ) id 1NSyxr-0004QK-Se for qemu-devel@nongnu.org; Thu, 07 Jan 2010 23:28:15 +0300 From: "Igor V. Kovalenko" Date: Thu, 07 Jan 2010 23:28:15 +0300 Message-ID: <20100107202815.16653.87375.stgit@skyserv> In-Reply-To: <20100107201810.16653.85771.stgit@skyserv> References: <20100107201810.16653.85771.stgit@skyserv> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH 5/9] sparc64: check for pending irq when pil, pstate or softint is changed List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org From: Igor V. Kovalenko Signed-off-by: Igor V. Kovalenko --- target-sparc/op_helper.c | 41 ++++++++++++++++++++++++++++++++++++++--- 1 files changed, 38 insertions(+), 3 deletions(-) diff --git a/target-sparc/op_helper.c b/target-sparc/op_helper.c index 3d7f64c..381e6c4 100644 --- a/target-sparc/op_helper.c +++ b/target-sparc/op_helper.c @@ -3301,6 +3301,12 @@ static inline void change_pstate(uint32_t new_pstate) void helper_wrpstate(target_ulong new_state) { change_pstate(new_state & 0xf3f); + +#if !defined(CONFIG_USER_ONLY) + if (cpu_interrupts_enabled(env)) { + cpu_check_irqs(env); + } +#endif } void helper_wrpil(target_ulong new_pil) @@ -3328,6 +3334,14 @@ void helper_done(void) change_pstate((tsptr->tstate >> 8) & 0xf3f); PUT_CWP64(env, tsptr->tstate & 0xff); env->tl--; + + DPRINTF_PSTATE("... helper_done tl=%d\n", env->tl); + +#if !defined(CONFIG_USER_ONLY) + if (cpu_interrupts_enabled(env)) { + cpu_check_irqs(env); + } +#endif } void helper_retry(void) @@ -3341,21 +3355,42 @@ void helper_retry(void) change_pstate((tsptr->tstate >> 8) & 0xf3f); PUT_CWP64(env, tsptr->tstate & 0xff); env->tl--; + + DPRINTF_PSTATE("... helper_retry tl=%d\n", env->tl); + +#if !defined(CONFIG_USER_ONLY) + if (cpu_interrupts_enabled(env)) { + cpu_check_irqs(env); + } +#endif +} + +static void do_modify_softint(const char* operation, uint32_t value) +{ + if (env->softint != value) { + env->softint = value; + DPRINTF_PSTATE(": %s new %08x\n", operation, env->softint); +#if !defined(CONFIG_USER_ONLY) + if (cpu_interrupts_enabled(env)) { + cpu_check_irqs(env); + } +#endif + } } void helper_set_softint(uint64_t value) { - env->softint |= (uint32_t)value; + do_modify_softint("helper_set_softint", env->softint | (uint32_t)value); } void helper_clear_softint(uint64_t value) { - env->softint &= (uint32_t)~value; + do_modify_softint("helper_clear_softint", env->softint & (uint32_t)~value); } void helper_write_softint(uint64_t value) { - env->softint = (uint32_t)value; + do_modify_softint("helper_write_softint", (uint32_t)value); } #endif