Received: from [140.186.70.92] (port=48987 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PcxqE-0007mU-IM for qemu-devel@nongnu.org; Wed, 12 Jan 2011 05:22:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PcxqD-0004rn-5W for qemu-devel@nongnu.org; Wed, 12 Jan 2011 05:22:10 -0500 Received: from hall.aurel32.net ([88.191.126.93]:54392) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PcxqC-0004rg-TS for qemu-devel@nongnu.org; Wed, 12 Jan 2011 05:22:09 -0500 Date: Wed, 12 Jan 2011 11:22:08 +0100 From: Aurelien Jarno Subject: Re: [Qemu-devel] [PATCH 7/8] target-arm: Set privileged bit in TB flags correctly for M profile Message-ID: <20110112102208.GK22287@hall.aurel32.net> References: <1294783938-19629-1-git-send-email-peter.maydell@linaro.org> <1294783938-19629-8-git-send-email-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <1294783938-19629-8-git-send-email-peter.maydell@linaro.org> Sender: Aurelien Jarno List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: qemu-devel@nongnu.org On Tue, Jan 11, 2011 at 10:12:17PM +0000, Peter Maydell wrote: > M profile ARM cores don't have a CPSR mode field. Set the bit in the > TB flags that indicates non-user mode correctly for these cores. > > Signed-off-by: Peter Maydell > --- > target-arm/cpu.h | 8 +++++++- > 1 files changed, 7 insertions(+), 1 deletions(-) Reviewed-by: Aurelien Jarno > diff --git a/target-arm/cpu.h b/target-arm/cpu.h > index 3adb118..3cd69c4 100644 > --- a/target-arm/cpu.h > +++ b/target-arm/cpu.h > @@ -472,13 +472,19 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp) > static inline void cpu_get_tb_cpu_state(CPUState *env, target_ulong *pc, > target_ulong *cs_base, int *flags) > { > + int privmode; > *pc = env->regs[15]; > *cs_base = 0; > *flags = (env->thumb << ARM_TBFLAG_THUMB_SHIFT) > | (env->vfp.vec_len << ARM_TBFLAG_VECLEN_SHIFT) > | (env->vfp.vec_stride << ARM_TBFLAG_VECSTRIDE_SHIFT) > | (env->condexec_bits << ARM_TBFLAG_CONDEXEC_SHIFT); > - if ((env->uncached_cpsr & CPSR_M) != ARM_CPU_MODE_USR) { > + if (arm_feature(env, ARM_FEATURE_M)) { > + privmode = !((env->v7m.exception == 0) && (env->v7m.control & 1)); > + } else { > + privmode = (env->uncached_cpsr & CPSR_M) != ARM_CPU_MODE_USR; > + } > + if (privmode) { > *flags |= ARM_TBFLAG_PRIV_MASK; > } > if (env->vfp.xregs[ARM_VFP_FPEXC] & (1 << 30)) { > -- > 1.6.3.3 > > > -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net