1 # This is a work round for a fairly serious GCC compiler bug - when
2 # the syscall assembler overwrites r7 (required on thumb) the
3 # compiler fails to protect the register when it is using it as a
6 --- uClibc-0.9.28/libc/sysdeps/linux/arm/bits/syscalls.h 2005-09-12 17:51:26.062205918 -0700
7 +++ uClibc-0.9.28/libc/sysdeps/linux/arm/bits/syscalls.h 2005-09-12 18:16:15.507930828 -0700
13 +/* This doesn't work because GCC uses r7 as a frame pointer in
14 + * some cases and doesn't notice that the _r7 value changes
15 + * it, resulting in mysterious crashes after the SWI.
17 #define INTERNAL_SYSCALL(name, err, nr, args...) \
18 ({ unsigned int _sys_result; \
25 +/* So hide the use of r7 from the compiler, this would be a lot
26 + * easier but for the fact that the syscalls can exceed 255.
27 + * For the moment the LOAD_ARG_7 is sacrificed.
29 +#define INTERNAL_SYSCALL(name, err, nr, args...) \
30 + ({ unsigned int _sys_result; \
32 + register int _a1 asm ("a1"); \
33 + LOAD_ARGS_##nr (args) \
34 + register int _v3 asm ("v3") = (int) (SYS_ify(name)); \
35 + asm volatile ("push {r7}\n" \
37 + "\tswi 0 @ syscall " #name "\n" \
40 + : "r" (_v3) ASM_ARGS_##nr \
42 + _sys_result = _a1; \
44 + (int) _sys_result; })
48 #undef INTERNAL_SYSCALL_ERROR_P