2002-10-06 Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h (INLINE_SYSCALL): Add all necessary register outputs for syscall-clobbered registers.
This commit is contained in:
parent
db7ffaa304
commit
704bb2fd8e
@ -37,52 +37,67 @@
|
||||
# include <errno.h>
|
||||
|
||||
# undef INLINE_SYSCALL
|
||||
# define INLINE_SYSCALL(name, nr, args...) \
|
||||
({ \
|
||||
long ret, err; \
|
||||
LOADARGS_##nr(name, args); \
|
||||
__asm __volatile ("sc\n\t" \
|
||||
"mfcr %1\n\t" \
|
||||
: "=r" (r3), "=r" (err) \
|
||||
: ASM_INPUT_##nr \
|
||||
: "cc", "memory"); \
|
||||
ret = r3; \
|
||||
if (err & 1 << 28) \
|
||||
{ \
|
||||
__set_errno (ret); \
|
||||
ret = -1L; \
|
||||
} \
|
||||
ret; \
|
||||
# define INLINE_SYSCALL(name, nr, args...) \
|
||||
({ \
|
||||
register long r0 __asm__ ("r0"); \
|
||||
register long r3 __asm__ ("r3"); \
|
||||
register long r4 __asm__ ("r4"); \
|
||||
register long r5 __asm__ ("r5"); \
|
||||
register long r6 __asm__ ("r6"); \
|
||||
register long r7 __asm__ ("r7"); \
|
||||
register long r8 __asm__ ("r8"); \
|
||||
register long r9 __asm__ ("r9"); \
|
||||
register long r10 __asm__ ("r10"); \
|
||||
register long r11 __asm__ ("r11"); \
|
||||
register long r12 __asm__ ("r12"); \
|
||||
long ret, err; \
|
||||
LOADARGS_##nr(name, args); \
|
||||
__asm__ __volatile__ \
|
||||
("sc\n\t" \
|
||||
"mfcr %0" \
|
||||
: "=&r" (r0), \
|
||||
"=&r" (r3), "=&r" (r4), "=&r" (r5), "=&r" (r6), "=&r" (r7), \
|
||||
"=&r" (r8), "=&r" (r9), "=&r" (r10), "=&r" (r11), "=&r" (r12) \
|
||||
: ASM_INPUT_##nr \
|
||||
: "cc", "memory"); \
|
||||
err = r0; \
|
||||
ret = r3; \
|
||||
if (err & (1 << 28)) \
|
||||
{ \
|
||||
__set_errno (ret); \
|
||||
ret = -1L; \
|
||||
} \
|
||||
ret; \
|
||||
})
|
||||
|
||||
# define LOADARGS_0(name) \
|
||||
register long r0 __asm__ ("r0") = __NR_##name; \
|
||||
register long r3 __asm__ ("r3")
|
||||
r0 = __NR_##name
|
||||
# define LOADARGS_1(name, arg1) \
|
||||
LOADARGS_0(name) = (long) (arg1)
|
||||
LOADARGS_0(name); \
|
||||
r3 = (long) (arg1)
|
||||
# define LOADARGS_2(name, arg1, arg2) \
|
||||
LOADARGS_1(name, arg1); \
|
||||
register long r4 __asm__ ("r4") = (long) (arg2)
|
||||
r4 = (long) (arg2)
|
||||
# define LOADARGS_3(name, arg1, arg2, arg3) \
|
||||
LOADARGS_2(name, arg1, arg2); \
|
||||
register long r5 __asm__ ("r5") = (long) (arg3)
|
||||
r5 = (long) (arg3)
|
||||
# define LOADARGS_4(name, arg1, arg2, arg3, arg4) \
|
||||
LOADARGS_3(name, arg1, arg2, arg3); \
|
||||
register long r6 __asm__ ("r6") = (long) (arg4)
|
||||
r6 = (long) (arg4)
|
||||
# define LOADARGS_5(name, arg1, arg2, arg3, arg4, arg5) \
|
||||
LOADARGS_4(name, arg1, arg2, arg3, arg4); \
|
||||
register long r7 __asm__ ("r7") = (long) (arg5)
|
||||
r7 = (long) (arg5)
|
||||
# define LOADARGS_6(name, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
LOADARGS_5(name, arg1, arg2, arg3, arg4, arg5); \
|
||||
register long r8 __asm__ ("r8") = (long) (arg6)
|
||||
r8 = (long) (arg6)
|
||||
|
||||
# define ASM_INPUT_0 "r" (r0)
|
||||
# define ASM_INPUT_1 ASM_INPUT_0, "0" (r3)
|
||||
# define ASM_INPUT_2 ASM_INPUT_1, "r" (r4)
|
||||
# define ASM_INPUT_3 ASM_INPUT_2, "r" (r5)
|
||||
# define ASM_INPUT_4 ASM_INPUT_3, "r" (r6)
|
||||
# define ASM_INPUT_5 ASM_INPUT_4, "r" (r7)
|
||||
# define ASM_INPUT_6 ASM_INPUT_5, "r" (r8)
|
||||
# define ASM_INPUT_0 "0" (r0)
|
||||
# define ASM_INPUT_1 ASM_INPUT_0, "1" (r3)
|
||||
# define ASM_INPUT_2 ASM_INPUT_1, "2" (r4)
|
||||
# define ASM_INPUT_3 ASM_INPUT_2, "3" (r5)
|
||||
# define ASM_INPUT_4 ASM_INPUT_3, "4" (r6)
|
||||
# define ASM_INPUT_5 ASM_INPUT_4, "5" (r7)
|
||||
# define ASM_INPUT_6 ASM_INPUT_5, "6" (r8)
|
||||
|
||||
#endif /* __ASSEMBLER__ */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user