From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34765) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WnHIz-0007KU-TA for qemu-devel@nongnu.org; Wed, 21 May 2014 20:56:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WnHIt-0000wm-Ut for qemu-devel@nongnu.org; Wed, 21 May 2014 20:56:21 -0400 Received: from mail-pa0-x234.google.com ([2607:f8b0:400e:c03::234]:43425) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WnHIt-0000wU-NO for qemu-devel@nongnu.org; Wed, 21 May 2014 20:56:15 -0400 Received: by mail-pa0-f52.google.com with SMTP id fa1so1912707pad.25 for ; Wed, 21 May 2014 17:56:14 -0700 (PDT) Date: Thu, 22 May 2014 00:56:46 +0000 From: "Edgar E. Iglesias" Message-ID: <20140522005646.GF30982@hostname> References: <1400491383-6725-1-git-send-email-edgar.iglesias@gmail.com> <1400491383-6725-17-git-send-email-edgar.iglesias@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH v3 16/22] target-arm: A64: Generalize ERET to various ELs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Rob Herring , Peter Crosthwaite , Fabian Aggeler , QEMU Developers , Alexander Graf , John Williams , Alex =?iso-8859-1?Q?Benn=E9e?= , Christoffer Dall , Richard Henderson On Wed, May 21, 2014 at 08:10:53PM +0100, Peter Maydell wrote: > On 19 May 2014 10:22, Edgar E. Iglesias wrote: > > From: "Edgar E. Iglesias" > > > > Adds support for ERET to Aarch64 EL2 and 3. > > > > Signed-off-by: Edgar E. Iglesias > > --- > > target-arm/op_helper.c | 10 +++++----- > > 1 file changed, 5 insertions(+), 5 deletions(-) > > > > diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c > > index d89755a..c632dd6 100644 > > --- a/target-arm/op_helper.c > > +++ b/target-arm/op_helper.c > > @@ -386,13 +386,13 @@ void HELPER(msr_i_pstate)(CPUARMState *env, uint32_t op, uint32_t imm) > > > > void HELPER(exception_return)(CPUARMState *env) > > { > > - unsigned int spsr_idx = is_a64(env) ? aarch64_banked_spsr_index(1) : 0; > > + int cur_el = arm_current_pl(env); > > + unsigned int spsr_idx = is_a64(env) ? aarch64_banked_spsr_index(cur_el) : 0; > > This will now allow the guest to trigger an assert() by doing an > ERET in EL0... The fix for that is to put in the check in translate-a64.c, > I think, since ERET in EL0 should be an UnallocatedEncoding. Nice catch. I've prepended this patch with a patch traping eret in el0 at translation time. Thanks, Edgar