Skip to contentSkip to conversation

Fix resume for 64K page size

PATCH Applied [email protected] 4 participants 5 messages Jul 10, 2007 – Jul 11, 2007 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix resume for 64K page size

This fixes a bug when running 64K page size on r4k machines.

---
 arch/mips/kernel/r4k_switch.S |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/mips/kernel/r4k_switch.S +1 -1
index 0672959..65f0f91 100644
@@ -85,7 +85,7 @@ #endif
 	move	$28, a2
 	cpu_restore_nonscratch a1
 
-#if (_THREAD_SIZE - 32) < 0x10000
+#if (_THREAD_SIZE) < 0x10000
 	PTR_ADDIU	t0, $28, _THREAD_SIZE - 32
 #else
 	PTR_LI		t0, _THREAD_SIZE - 32
Signature · 1 line
1.4.2.4
Applied
#1 lore raw
Quoted 1 line · On Tue, Jul 10, 2007 at 01:20:51PM -0400, [email protected] wrote:

This fixes a bug when running 64K page size on r4k machines.

Thanks, applied.

Ralf

#2 lore raw
In reply to [email protected]
Quoted 13 lines · [email protected] wrote:

This fixes a bug when running 64K page size on r4k machines.

---
 arch/mips/kernel/r4k_switch.S |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/mips/kernel/r4k_switch.S +0 -0
index 0672959..65f0f91 100644

arch/mips/kernel/r4k_switch.S #endif · line 91

Quoted 8 lines
arch/mips/kernel/r4k_switch.S +1 -1
@@ -85,7 +85,7 @@ #endif
 	move	$28, a2
 	cpu_restore_nonscratch a1
 
-#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.

Thiemo

#3 lore raw
Quoted 11 lines · Thiemo Seufer

Review

Quoted 5 lines
(quoted diff) +1 -1
-#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

arch/mips/kernel/r4k_switch.S +1 -6
index 65f0f91..d9bfae5 100644
@@ -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 */
#4 lore raw
In reply to [email protected]

arch/mips/kernel/r4k_switch.S #endif · line 91

Quoted 9 lines · On Tue, 10 Jul 2007, [email protected] wrote:
arch/mips/kernel/r4k_switch.S +1 -1
@@ -85,7 +85,7 @@ #endif
 	move	$28, a2
 	cpu_restore_nonscratch a1
 
-#if (_THREAD_SIZE - 32) < 0x10000
+#if (_THREAD_SIZE) < 0x10000
 	PTR_ADDIU	t0, $28, _THREAD_SIZE - 32
 #else
 	PTR_LI		t0, _THREAD_SIZE - 32

It looks wrong to me. Shouldn't that be:

#if (_THREAD_SIZE - 32) < 0x8000

Maciej