This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA: Fix linux syscall stubs for Thumb


Yes, please go ahead. You don't require permission to fix arm/thumb problems.

-- Jeff J.

On 23/10/09 10:46 AM, Nick Clifton wrote:
Hi Jeff,

   The code in libgloss/arm/linux-syscalls0.S has some macros for
   working in Thumb mode which are totally bogus!  It turns out that
   the ARM based macros work just as well in Thumb mode, so I would
   like to apply the attached patch to remove them.

Tested (but not by me) by building a Thumb based linux toolchain.

Cheers
   Nick

libgloss/ChangeLog
2009-10-23  Nick Clifton<nickc@redhat.com>

	* arm/linux-syscalls0.S (SYSCALL0, SYSCALL3, SYSCALL6, SYSCALL4):
	Delete Thumb definitions - the ARM versions work correctly in
	Thumb mode.

Index: libgloss/arm/linux-syscalls0.S
===================================================================
RCS file: /cvs/src/src/libgloss/arm/linux-syscalls0.S,v
retrieving revision 1.5
diff -c -3 -p -r1.5 linux-syscalls0.S
*** libgloss/arm/linux-syscalls0.S	3 Oct 2006 16:33:50 -0000	1.5
--- libgloss/arm/linux-syscalls0.S	23 Oct 2009 14:40:26 -0000
***************
*** 19,65 ****
   #define GLOBAL(name) .global name; FUNC(name)
   #define SIZE(name) .size name, .-name

- #if __thumb__
-
- # define SYSCALL0(name) \
- 	GLOBAL(_ ## name); \
- 	mov r12, r7; \
- 	mov r7, #SYS_ ## name; \
- 	swi; \
- 	mov r7, r12; \
- 	b _set_errno; \
- 	SIZE(_ ## name)
-
- /* static int _syscall3(int a, int b, int c, int number); */
- FUNC(_syscall3)
- 	push { r7 }
- 	mov r7, r3
- 	swi
- 	pop { r7 }
- 	b _set_errno
- 	SIZE(_syscall3)
-
- # define SYSCALL3(name) \
- 	GLOBAL(_ ## name); \
- 	mov r3, #SYS_ ## name; \
- 	b _syscall3; \
- 	SIZE(_ ## name)
-
- # define SYSCALL6(name) \
- 	GLOBAL(_ ## name); \
- 	push { r4 - r5, r7 }; \
- 	ldr r4, [sp, #12]; \
- 	ldr r5, [sp, #16]; \
- 	mov r7, #SYS_ ## name; \
- 	swi; \
- 	pop { r4 - r5, r7 }; \
- 	b _set_errno; \
- 	SIZE(_ ## name)
-
- # define SYSCALL4(name) SYSCALL6(name)
-
- #else /* __thumb__ */
-
   # define SYSCALL4(name) \
   	GLOBAL(_ ## name); \
   	swi #SYS_ ## name; \
--- 19,24 ----
*************** FUNC(_syscall3)
*** 78,86 ****

   #define SYSCALL0(name) SYSCALL3(name)
   #define SYSCALL3(name) SYSCALL4(name)
-
- #endif /* __thumb__ */
-
   #define SYSCALL1(name) SYSCALL3(name)
   #define SYSCALL2(name) SYSCALL3(name)
   #define SYSCALL5(name) SYSCALL6(name)
--- 37,42 ----


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]