From patchwork Fri May 30 07:28:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 353910 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 6D4A414007E for ; Fri, 30 May 2014 17:36:36 +1000 (EST) Received: from localhost ([::1]:51920 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WqHMg-0003yf-F6 for incoming@patchwork.ozlabs.org; Fri, 30 May 2014 03:36:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49595) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WqHMC-0003AT-Su for qemu-devel@nongnu.org; Fri, 30 May 2014 03:36:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WqHM6-0005xr-CQ for qemu-devel@nongnu.org; Fri, 30 May 2014 03:36:04 -0400 Received: from mail-pb0-x229.google.com ([2607:f8b0:400e:c01::229]:56572) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WqHM6-0005xj-6S for qemu-devel@nongnu.org; Fri, 30 May 2014 03:35:58 -0400 Received: by mail-pb0-f41.google.com with SMTP id uo5so1434886pbc.14 for ; Fri, 30 May 2014 00:35:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OCbLRYdql/Q9xCG93EFiJO6vO+aaXuLFaZy3qoaQhXQ=; b=fVZUthUvBhliaELs/VoUo8vz8PqBt6vzoUn0gJBwypewW8ZPoS1gXVc2g+Si4/pIrf Va6hQ3ZQ1J+Cxf39RkaH+I5i281UOWpDDkFvaWn5VOd2rr3fBLZfav8mqN7wog1b2OF0 ZUXBBKFI32n0UUPe01SBDk7m3UmKOht5NGVXcHAanidsJFzHmb+iGfmPc90vaX3h4Kb6 4JE4zCD6Lb0H/CHPvHwGvMw/EdWIvJYEu9lXQ9Rz8CrHCdPV/LWjEqDax+B7NBid2iWh 1RpT1ddpcJvrMQiuZZoa8Vc2sLVdsGPutenPOQcWrVCk5Vtua+vv7UjofNNZKF9kEeBP IfZQ== X-Received: by 10.68.201.226 with SMTP id kd2mr15714356pbc.157.1401435357393; Fri, 30 May 2014 00:35:57 -0700 (PDT) Received: from localhost ([203.126.243.116]) by mx.google.com with ESMTPSA id ao4sm4814540pbc.51.2014.05.30.00.35.51 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 30 May 2014 00:35:56 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Fri, 30 May 2014 17:28:25 +1000 Message-Id: <1401434911-26992-11-git-send-email-edgar.iglesias@gmail.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1401434911-26992-1-git-send-email-edgar.iglesias@gmail.com> References: <1401434911-26992-1-git-send-email-edgar.iglesias@gmail.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c01::229 Cc: rob.herring@linaro.org, peter.crosthwaite@xilinx.com, aggelerf@ethz.ch, agraf@suse.de, blauwirbel@gmail.com, john.williams@xilinx.com, greg.bellows@linaro.org, pbonzini@redhat.com, alex.bennee@linaro.org, christoffer.dall@linaro.org, rth@twiddle.net Subject: [Qemu-devel] [PATCH v1 10/16] target-arm: Break out exception masking to a separate func X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: "Edgar E. Iglesias" Signed-off-by: Edgar E. Iglesias --- cpu-exec.c | 5 ++--- target-arm/cpu.h | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/cpu-exec.c b/cpu-exec.c index 38e5f02..a579ffc 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -478,7 +478,7 @@ int cpu_exec(CPUArchState *env) } #elif defined(TARGET_ARM) if (interrupt_request & CPU_INTERRUPT_FIQ - && !(env->daif & PSTATE_F)) { + && arm_excp_unmasked(cpu, EXCP_FIQ)) { cpu->exception_index = EXCP_FIQ; cc->do_interrupt(cpu); next_tb = 0; @@ -493,8 +493,7 @@ int cpu_exec(CPUArchState *env) We avoid this by disabling interrupts when pc contains a magic address. */ if (interrupt_request & CPU_INTERRUPT_HARD - && ((IS_M(env) && env->regs[15] < 0xfffffff0) - || !(env->daif & PSTATE_I))) { + && arm_excp_unmasked(cpu, EXCP_IRQ)) { cpu->exception_index = EXCP_IRQ; cc->do_interrupt(cpu); next_tb = 0; diff --git a/target-arm/cpu.h b/target-arm/cpu.h index 5c74adc..9eddcc1 100644 --- a/target-arm/cpu.h +++ b/target-arm/cpu.h @@ -1130,6 +1130,22 @@ bool write_cpustate_to_list(ARMCPU *cpu); # define TARGET_VIRT_ADDR_SPACE_BITS 32 #endif +static inline bool arm_excp_unmasked(CPUState *cs, unsigned int excp_idx) +{ + CPUARMState *env = cs->env_ptr; + + switch (excp_idx) { + case EXCP_FIQ: + return !(env->daif & PSTATE_F); + case EXCP_IRQ: + return ((IS_M(env) && env->regs[15] < 0xfffffff0) + || !(env->daif & PSTATE_I)); + default: + assert(0); + break; + } +} + static inline CPUARMState *cpu_init(const char *cpu_model) { ARMCPU *cpu = cpu_arm_init(cpu_model);