Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: James Cowgill <James.Cowgill@imgtec.com>,
	"Maciej W. Rozycki" <macro@linux-mips.org>
Cc: linux-mips@linux-mips.org, stable@vger.kernel.org
Subject: Re: [PATCH] MIPS: replace add and sub instructions in relocate_kernel.S with addiu
Date: Mon, 3 Aug 2015 15:30:24 +0200	[thread overview]
Message-ID: <20150803133024.GB2843@linux-mips.org> (raw)
In-Reply-To: <1434557570-30452-1-git-send-email-James.Cowgill@imgtec.com>

On Wed, Jun 17, 2015 at 05:12:50PM +0100, James Cowgill wrote:

> Fixes the assembler errors generated when compiling a MIPS R6 kernel with
> CONFIG_KEXEC on, by replacing the offending add and sub instructions with
> addiu instructions.
> 
> Build errors:
> arch/mips/kernel/relocate_kernel.S: Assembler messages:
> arch/mips/kernel/relocate_kernel.S:27: Error: invalid operands `dadd $16,$16,8'
> arch/mips/kernel/relocate_kernel.S:64: Error: invalid operands `dadd $20,$20,8'
> arch/mips/kernel/relocate_kernel.S:65: Error: invalid operands `dadd $18,$18,8'
> arch/mips/kernel/relocate_kernel.S:66: Error: invalid operands `dsub $22,$22,1'
> scripts/Makefile.build:294: recipe for target 'arch/mips/kernel/relocate_kernel.o' failed
> 
> Signed-off-by: James Cowgill <James.Cowgill@imgtec.com>
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: <stable@vger.kernel.org> # 4.0+
> ---
>  arch/mips/kernel/relocate_kernel.S | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/mips/kernel/relocate_kernel.S b/arch/mips/kernel/relocate_kernel.S
> index 74bab9d..c6bbf21 100644
> --- a/arch/mips/kernel/relocate_kernel.S
> +++ b/arch/mips/kernel/relocate_kernel.S
> @@ -24,7 +24,7 @@ LEAF(relocate_new_kernel)
>  
>  process_entry:
>  	PTR_L		s2, (s0)
> -	PTR_ADD		s0, s0, SZREG
> +	PTR_ADDIU	s0, s0, SZREG
>  
>  	/*
>  	 * In case of a kdump/crash kernel, the indirection page is not
> @@ -61,9 +61,9 @@ copy_word:
>  	/* copy page word by word */
>  	REG_L		s5, (s2)
>  	REG_S		s5, (s4)
> -	PTR_ADD		s4, s4, SZREG
> -	PTR_ADD		s2, s2, SZREG
> -	LONG_SUB	s6, s6, 1
> +	PTR_ADDIU	s4, s4, SZREG
> +	PTR_ADDIU	s2, s2, SZREG
> +	LONG_ADDIU	s6, s6, -1

Thanks, applied.

But I was wondering if maybe we should redefine the PTR_ADD, LONG_SUB etc
macros to expand into a signed operation for R6.  While I can't convince
myself it's the right and conceptually clean thing to do, I don't think
it'd be clearly wrong and it might help preventing numersous bugs by
applications that use <asm/asm.h>.  Opinions?

  Ralf

  parent reply	other threads:[~2015-08-03 13:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-17 16:12 [PATCH] MIPS: replace add and sub instructions in relocate_kernel.S with addiu James Cowgill
2015-06-17 16:12 ` James Cowgill
2015-08-03 13:30 ` Ralf Baechle [this message]
2015-08-03 14:12   ` Maciej W. Rozycki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150803133024.GB2843@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=James.Cowgill@imgtec.com \
    --cc=linux-mips@linux-mips.org \
    --cc=macro@linux-mips.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox