|
Subject: [RFC][PATCH] Workaround for r7 corruption in Thumb syscalls Newsgroups: gmane.linux.ports.arm.kernel Date: 2006-09-06 21:42:02 GMT (2 years, 43 weeks, 16 hours and 27 minutes ago) The following commit caused regressions for Thumb syscalls: http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3f2829a31573e3e502b874c8d69a765f7a778793 GCC reserves r7 for use as a frame pointer for the Thumb case and does not properly handle other uses of r7 such as in the current ARM kernel syscall macros. This is technically a "limitation" of GCC but is also a regression relative to past implementation of ARM syscall macros. Current use of r7 in the ARM kernel syscall macros results in code generation errors when those macros are used in userspace Thumb code. This change reverts the ARM kernel syscall macros to earlier behavior in which r7 is preserved during syscalls for the Thumb code case and also slightly modifies that implementation in order to support syscall numbers over 255. Signed-off-by: George G. Davis <gdavis <at> mvista.com> Index: linux-2.6.10/include/asm-arm/unistd.h =================================================================== --- linux-2.6.10.orig/include/asm-arm/unistd.h +++ linux-2.6.10/include/asm-arm/unistd.h @@ -416,9 +416,13 @@ #ifndef __syscall #if defined(__thumb__) || defined(__MV_SYS_EABI__) -#define __SYS_REG(name) register long __sysreg __asm__("r7") = __NR_##name; +#define __SYS_REG(name) register long __sysreg __asm__ ("v3") = __NR_##name; #define __SYS_REG_LIST(regs...) "r" (__sysreg) , ##regs -#define __syscall(name) "swi\t0" +#define __syscall(name) \ + "push {r7}\n\t" \ + "mov r7, v3\n\t" \ + "swi 0\n\t" \ + "pop {r7}" #else #define __SYS_REG(name) #define __SYS_REG_LIST(regs...) regs Comments/feedback appreciated. TIA! -- Regards, George ------------------------------------------------------------------- List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel FAQ: http://www.arm.linux.org.uk/mailinglists/faq.php Etiquette: http://www.arm.linux.org.uk/mailinglists/etiquette.php |
|
|