]> git.pld-linux.org Git - packages/uClibc.git/blame - uClibc-ppc-syscall.patch
- quote other __cc
[packages/uClibc.git] / uClibc-ppc-syscall.patch
CommitLineData
7e8456de
PS
1This patch modifies the syscall code for the powerpc, and leaves it like it was previosly
2(older version of the uclibc repository). It uses the syscall code from the kernel.
3
4This way it compiles properly with gcc-4. The problem was that the previous code defined the
5functions in assembly code, so that the compiler didn't think the functions had a definition
6so that the next weak aliases to those functions didn't work because they were not defined.
7(Previous version of gcc compilers work when definin weak aliases to undefined functions).
8
9Maybe the syscall code could be reworked again, but meanwhile I left with the kernel
10default syscall code, that was the original aproach of uclibc.
11
12
13diff -urP uClibc-0.9.28/libc/sysdeps/linux/powerpc/bits/syscalls.h uClibc-0.9.28-syscall/libc/sysdeps/linux/powerpc/bits/syscalls.h
14--- uClibc-0.9.28/libc/sysdeps/linux/powerpc/bits/syscalls.h 2005-08-18 00:49:41.000000000 +0200
15+++ uClibc-0.9.28-syscall/libc/sysdeps/linux/powerpc/bits/syscalls.h 2005-08-23 10:14:53.000000000 +0200
16@@ -5,67 +5,55 @@
17 # error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead."
18 #endif
19
20+#include <features.h>
21+
22+/* Do something very evil for now. Until we create our own syscall
23+ * macros, short circuit bits/sysnum.h and use asm/unistd.h instead */
24+#include <asm/unistd.h>
25+
26 /* This includes the `__NR_<name>' syscall numbers taken from the Linux kernel
27 * header files. It also defines the traditional `SYS_<name>' macros for older
28 * programs. */
29 #include <bits/sysnum.h>
30
31-
32-#define __STRINGIFY(s) __STRINGIFY2 (s)
33-#define __STRINGIFY2(s) #s
34-
35-#undef JUMPTARGET
36-#ifdef __PIC__
37-#define __MAKE_SYSCALL __STRINGIFY(__uClibc_syscall@plt)
38-#else
39-#define __MAKE_SYSCALL __STRINGIFY(__uClibc_syscall)
40-#endif
41-
42-#define unified_syscall_body(name) \
43- __asm__ ( \
44- ".section \".text\"\n\t" \
45- ".align 2\n\t" \
46- ".globl " __STRINGIFY(name) "\n\t" \
47- ".type " __STRINGIFY(name) ",@function\n\t" \
48- #name":\tli 0," __STRINGIFY(__NR_##name) "\n\t" \
49- "b " __MAKE_SYSCALL "\n\t" \
50- ".size\t" __STRINGIFY(name) ",.""-" __STRINGIFY(name) "\n" \
51- )
52-
53-#undef _syscall0
54-#define _syscall0(type,name) \
55-type name(void); \
56-unified_syscall_body(name)
57-
58-#undef _syscall1
59-#define _syscall1(type,name,type1,arg1) \
60-type name(type1 arg1); \
61-unified_syscall_body(name)
62-
63-#undef _syscall2
64-#define _syscall2(type,name,type1,arg1,type2,arg2) \
65-type name(type1 arg1, type2 arg2); \
66-unified_syscall_body(name)
67-
68-#undef _syscall3
69-#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
70-type name(type1 arg1, type2 arg2, type3 arg3); \
71-unified_syscall_body(name)
72-
73-#undef _syscall4
74-#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
75-type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4); \
76-unified_syscall_body(name)
77-
78-#undef _syscall5
79-#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \
80-type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5); \
81-unified_syscall_body(name)
82-
83+/* The kernel includes don't provide _syscall6, so provide our own */
84 #undef _syscall6
85 #define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \
86-type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6); \
87-unified_syscall_body(name)
88+type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) \
89+{ \
90+ unsigned long __sc_ret, __sc_err; \
91+ { \
92+ register unsigned long __sc_0 __asm__ ("r0"); \
93+ register unsigned long __sc_3 __asm__ ("r3"); \
94+ register unsigned long __sc_4 __asm__ ("r4"); \
95+ register unsigned long __sc_5 __asm__ ("r5"); \
96+ register unsigned long __sc_6 __asm__ ("r6"); \
97+ register unsigned long __sc_7 __asm__ ("r7"); \
98+ register unsigned long __sc_8 __asm__ ("r8"); \
99+ \
100+ __sc_3 = (unsigned long) (arg1); \
101+ __sc_4 = (unsigned long) (arg2); \
102+ __sc_5 = (unsigned long) (arg3); \
103+ __sc_6 = (unsigned long) (arg4); \
104+ __sc_7 = (unsigned long) (arg5); \
105+ __sc_8 = (unsigned long) (arg6); \
106+ __sc_0 = __NR_##name; \
107+ __asm__ __volatile__ \
108+ ("sc \n\t" \
109+ "mfcr %1 " \
110+ : "=&r" (__sc_3), "=&r" (__sc_0) \
111+ : "0" (__sc_3), "1" (__sc_0), \
112+ "r" (__sc_4), \
113+ "r" (__sc_5), \
114+ "r" (__sc_6), \
115+ "r" (__sc_7), \
116+ "r" (__sc_8) \
b999b0f0 117+ : "r9", "r10", "r11", "r12"); \
7e8456de
PS
118+ __sc_ret = __sc_3; \
119+ __sc_err = __sc_0; \
120+ } \
b999b0f0 121+ return (__sc_err & 0x10000000 ? __set_errno(__sc_ret), __sc_ret = -1 : 0), (type)__sc_ret; \
7e8456de
PS
122+}
123
124 #endif /* _BITS_SYSCALLS_H */
125
This page took 0.077045 seconds and 4 git commands to generate.