From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751360AbdBXKGM (ORCPT ); Fri, 24 Feb 2017 05:06:12 -0500 Received: from mail.southpole.se ([37.247.8.11]:58843 "EHLO mail.southpole.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751125AbdBXKGH (ORCPT ); Fri, 24 Feb 2017 05:06:07 -0500 X-Assp-Version: 2.5.5(16366) on assp.southpole.se X-Assp-ID: assp.southpole.se 28110-02989 X-Assp-Session: 7FBF228AFBB0 (mail 1) X-Assp-Client-SSL: yes X-Assp-Server-TLS: yes Subject: Re: [PATCH v4 24/24] openrisc: head: Init r0 to 0 on start To: Stafford Horne , Stefan Kristiansson References: <77f7a25e10627b60b2553817f05b20ec2ec25a28.1487910170.git.shorne@gmail.com> Cc: linux@roeck-us.net, openrisc@lists.librecores.org, linux-kernel@vger.kernel.org From: Jonas Bonn Message-ID: Date: Fri, 24 Feb 2017 10:21:50 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <77f7a25e10627b60b2553817f05b20ec2ec25a28.1487910170.git.shorne@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/24/2017 05:32 AM, Stafford Horne wrote: > Originally openrisc spec 0 specified that r0 would be wired to ground. > This is no longer the case. r0 is not guaranteed to be 0 at init, so we > need to initialize it to 0 before using it. > > Also, if we are clearing r0 we cant use r0 to clear itself. Change the > the CLEAR_GPR macro to use movhi for clearing. Use the Reported-by: tag here since you are taking the time to mention him in the summary mail. Reported-by: Jakob... > Signed-off-by: Stafford Horne > --- > arch/openrisc/kernel/head.S | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/arch/openrisc/kernel/head.S b/arch/openrisc/kernel/head.S > index 573e131..e8a1784 100644 > --- a/arch/openrisc/kernel/head.S > +++ b/arch/openrisc/kernel/head.S > @@ -35,7 +35,7 @@ > l.add rd,rd,rs > > #define CLEAR_GPR(gpr) \ > - l.or gpr,r0,r0 > + l.movhi gpr,0x0 > > #define LOAD_SYMBOL_2_GPR(gpr,symbol) \ > l.movhi gpr,hi(symbol) ;\ > @@ -443,6 +443,9 @@ _dispatch_do_ipage_fault: > __HEAD > .global _start > _start: > + /* Init r0 to zero as per spec */ > + CLEAR_GPR(r0) > + > /* save kernel parameters */ > l.or r25,r0,r3 /* pointer to fdt */ >