From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751346AbdBXUNT (ORCPT ); Fri, 24 Feb 2017 15:13:19 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:34039 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751163AbdBXUNL (ORCPT ); Fri, 24 Feb 2017 15:13:11 -0500 Date: Sat, 25 Feb 2017 05:13:08 +0900 From: Stafford Horne To: Jonas Bonn Cc: Stefan Kristiansson , linux@roeck-us.net, openrisc@lists.librecores.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 20/24] openrisc: entry: Fix delay slot detection Message-ID: <20170224201308.GU2449@lianli.shorne-pla.net> References: <34caff307ead3a1b67a7226507082ace94e22875.1487910170.git.shorne@gmail.com> <188dcb34-4e8e-7636-e31d-2ae451dac2ff@southpole.se> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <188dcb34-4e8e-7636-e31d-2ae451dac2ff@southpole.se> User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 24, 2017 at 10:32:32AM +0100, Jonas Bonn wrote: > On 02/24/2017 05:32 AM, Stafford Horne wrote: > > Use execption SR stored in pt_regs for detection, the current SR is not > > correct as the handler is running after return from exception. > > > > Also, The code that checks for a delay slot uses a flag bitmask and then > > wants to check if the result is not zero. The test it implemented was > > wrong. > > > > Correct it by changing the test to check result against non zero. > > This wants to be two patches as you are changing two different things. Hi Jonas, Technically yes, two things, but... The logic is broken without both fixes. It would be a nightmare for someone to review these one-liners as two patches. I would like to keep as one. -Stafford > > > > Signed-off-by: Stafford Horne > > --- > > arch/openrisc/kernel/entry.S | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/arch/openrisc/kernel/entry.S b/arch/openrisc/kernel/entry.S > > index daae2a4..bc65008 100644 > > --- a/arch/openrisc/kernel/entry.S > > +++ b/arch/openrisc/kernel/entry.S > > @@ -258,9 +258,9 @@ EXCEPTION_ENTRY(_data_page_fault_handler) > > #else > > - l.mfspr r6,r0,SPR_SR // SR > > + l.lwz r6,PT_SR(r3) // SR > > l.andi r6,r6,SPR_SR_DSX // check for delay slot exception > > - l.sfeqi r6,0x1 // exception happened in delay slot > > + l.sfne r6,r0 // exception happened in delay slot > > l.bnf 7f > > l.lwz r6,PT_PC(r3) // address of an offending insn > >