All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: Thiemo Seufer <ths@networkno.de>
Cc: pwatkins@sicortex.com, linux-mips@linux-mips.org, From:
Subject: Re: [PATCH] [MIPS] Fix resume for 64K page size
Date: Wed, 11 Jul 2007 08:36:19 +0100	[thread overview]
Message-ID: <20070711073619.GA4056@linux-mips.org> (raw)
In-Reply-To: <20070710173454.GA30521@networkno.de>

On Tue, Jul 10, 2007 at 06:34:54PM +0100, Thiemo Seufer wrote:

> > -#if (_THREAD_SIZE - 32) < 0x10000
> > +#if (_THREAD_SIZE) < 0x10000
> >  	PTR_ADDIU	t0, $28, _THREAD_SIZE - 32
> >  #else
> >  	PTR_LI		t0, _THREAD_SIZE - 32
> 
> This doesn't look right. I think it should be
> 
> #if (_THREAD_SIZE - 32) < 0x8000
> 
> in order to avoid an overflow of the immediate.

Indeed - that's the limitation of the (d)addiu instruction.  But (d)addu
instead handle large constants just fine, so I'd below patch instead.  So
why not let the assembler do the dirty work.

  Ralf

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

diff --git a/arch/mips/kernel/r4k_switch.S b/arch/mips/kernel/r4k_switch.S
index 65f0f91..d9bfae5 100644
--- a/arch/mips/kernel/r4k_switch.S
+++ b/arch/mips/kernel/r4k_switch.S
@@ -85,12 +85,7 @@
 	move	$28, a2
 	cpu_restore_nonscratch a1
 
-#if (_THREAD_SIZE) < 0x10000
-	PTR_ADDIU	t0, $28, _THREAD_SIZE - 32
-#else
-	PTR_LI		t0, _THREAD_SIZE - 32
-	PTR_ADDU	t0, $28
-#endif
+	PTR_ADDU	t0, $28, _THREAD_SIZE - 32
 	set_saved_sp	t0, t1, t2
 #ifdef CONFIG_MIPS_MT_SMTC
 	/* Read-modify-writes of Status must be atomic on a VPE */

WARNING: multiple messages have this Message-ID (diff)
From: Ralf Baechle <ralf@linux-mips.org>
To: Thiemo Seufer <ths@networkno.de>
Cc: pwatkins@sicortex.com, linux-mips@linux-mips.org
Subject: Re: [PATCH] [MIPS] Fix resume for 64K page size
Date: Wed, 11 Jul 2007 08:36:19 +0100	[thread overview]
Message-ID: <20070711073619.GA4056@linux-mips.org> (raw)
Message-ID: <20070711073619.kjh3ht8Zqi2LQYsWquN7clV3815Mf1bMEvRLc_Agfuo@z> (raw)
In-Reply-To: <20070710173454.GA30521@networkno.de>

On Tue, Jul 10, 2007 at 06:34:54PM +0100, Thiemo Seufer wrote:

> > -#if (_THREAD_SIZE - 32) < 0x10000
> > +#if (_THREAD_SIZE) < 0x10000
> >  	PTR_ADDIU	t0, $28, _THREAD_SIZE - 32
> >  #else
> >  	PTR_LI		t0, _THREAD_SIZE - 32
> 
> This doesn't look right. I think it should be
> 
> #if (_THREAD_SIZE - 32) < 0x8000
> 
> in order to avoid an overflow of the immediate.

Indeed - that's the limitation of the (d)addiu instruction.  But (d)addu
instead handle large constants just fine, so I'd below patch instead.  So
why not let the assembler do the dirty work.

  Ralf

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

diff --git a/arch/mips/kernel/r4k_switch.S b/arch/mips/kernel/r4k_switch.S
index 65f0f91..d9bfae5 100644
--- a/arch/mips/kernel/r4k_switch.S
+++ b/arch/mips/kernel/r4k_switch.S
@@ -85,12 +85,7 @@
 	move	$28, a2
 	cpu_restore_nonscratch a1
 
-#if (_THREAD_SIZE) < 0x10000
-	PTR_ADDIU	t0, $28, _THREAD_SIZE - 32
-#else
-	PTR_LI		t0, _THREAD_SIZE - 32
-	PTR_ADDU	t0, $28
-#endif
+	PTR_ADDU	t0, $28, _THREAD_SIZE - 32
 	set_saved_sp	t0, t1, t2
 #ifdef CONFIG_MIPS_MT_SMTC
 	/* Read-modify-writes of Status must be atomic on a VPE */

  reply	other threads:[~2007-07-11  9:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-10 17:20 [PATCH] [MIPS] Fix resume for 64K page size pwatkins
2007-07-10 17:20 ` pwatkins
2007-07-10 17:15 ` Ralf Baechle
2007-07-10 17:15   ` Ralf Baechle
2007-07-10 17:34 ` Thiemo Seufer
2007-07-10 17:34   ` Thiemo Seufer
2007-07-11  7:36   ` Ralf Baechle [this message]
2007-07-11  7:36     ` Ralf Baechle
2007-07-10 17:36 ` 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=20070711073619.GA4056@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=linux-mips@linux-mips.org \
    --cc=pwatkins@sicortex.com \
    --cc=ths@networkno.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.