Skip to contentSkip to conversation

microblaze: nommu: Don't clobber R11 on syscalls

PATCH In review [email protected] 2 participants 3 messages Dec 14, 2009 – Dec 15, 2009 1 message not in the archive Microblaze architecture

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 microblaze: nommu: Don't clobber R11 on syscalls

The noMMU syscall trap has a bug that causes R11 to be zero on return to userland. Remove the extra "save" of R11 responsible for the bug, as well as an unnecessary extra "load".

---

arch/microblaze/kernel/entry-nommu.S +0 -2
diff -uprN a/arch/microblaze/kernel/entry-nommu.S b/arch/microblaze/kernel/entry-nommu.S
@@ -208,8 +208,6 @@ ENTRY(_user_exception)
 	lwi	r1, r1, TS_THREAD_INFO		/* get the thread info */
 	/* calculate kernel stack pointer */
 	addik	r1, r1, THREAD_SIZE - PT_SIZE
-	swi	r11, r0, PER_CPU(R11_SAVE)	/* temporarily save r11 */
-	lwi	r11, r0, PER_CPU(KM)		/* load mode indicator */
 2:
 	swi	r11, r1, PT_MODE		/* store the mode */
 	lwi	r11, r0, PER_CPU(R11_SAVE)	/* reload r11 */

A message that is not in the archive (sent off-list or not yet received): 005801ca7d0f$deaef5b0$9c0ce110$@com

#2 lore raw
Quoted 2 lines · Jim Van Vorst

Isn't R11 a temporary? If it doesn't need to be preserved across function calls, why can't it be clobbered during a syscall?

Because the Microblaze syscall macros don't include r11 in the clobber list. I suppose an alternative solution would just change the userspace macros and not the kernel, even though there is a bug in the kernel.

Michal, is the Microblaze ABI considered "locked down" now, or is a kernel solution still permitted?

------------------------------------------------------------------------
Steven J. Magnani "I claim this network for MARS!
www.digidescorp.com Earthling, return my space modulator!"

#include <standard.disclaimer>

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

The noMMU syscall trap has a bug that causes R11 to be zero on return to userland. Remove the extra "save" of R11 responsible for the bug, as well as an unnecessary extra "load".

It seems to me that this patch means that you tested it.
But anyway I was pretty sure that I am right that's why I did this change myself. This patch is already in Linus tree.

Thanks for test,
Michal

Quoted 16 lines

---
diff -uprN a/arch/microblaze/kernel/entry-nommu.S b/arch/microblaze/kernel/entry-nommu.S

arch/microblaze/kernel/entry-nommu.S +0 -2
@@ -208,8 +208,6 @@ ENTRY(_user_exception)
 	lwi	r1, r1, TS_THREAD_INFO		/* get the thread info */
 	/* calculate kernel stack pointer */
 	addik	r1, r1, THREAD_SIZE - PT_SIZE
-	swi	r11, r0, PER_CPU(R11_SAVE)	/* temporarily save r11 */
-	lwi	r11, r0, PER_CPU(KM)		/* load mode indicator */
 2:
 	swi	r11, r1, PT_MODE		/* store the mode */
 	lwi	r11, r0, PER_CPU(R11_SAVE)	/* reload r11 */
Signature · 4 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian