svn commit: trunk/uClibc: include libc/misc/internals libc/sysdeps etc...
Peter S. Mazinger
ps.m at gmx.net
Thu Aug 24 11:52:19 UTC 2006
On Wed, 23 Aug 2006, Mike Frysinger wrote:
> On Wednesday 23 August 2006 19:51, Peter S. Mazinger wrote:
> > On Wed, 23 Aug 2006 vapier at uclibc.org wrote:
> > > trunk/uClibc/libc/sysdeps/linux/arm/bits/syscalls.h
> >
> > this will fail on arm
> > errno.h may be included only for #ifndef __ASSEMBLER__
> > somehow the include went in at the wrong location
>
> yeah i typoed it, fixed now
> -mike
Attached the fix:
- SYS_ify is used by DO_CALL
- DO_CALL is used if __ASSEMBLER__
- errno.h in !__ASSEMBLER__
- s/asm/__asm__/
Peter
--
Peter S. Mazinger <ps dot m at gmx dot net> ID: 0xA5F059F2
Key fingerprint = 92A4 31E1 56BC 3D5A 2D08 BB6E C389 975E A5F0 59F2
-------------- next part --------------
Index: uClibc/libc/sysdeps/linux/arm/bits/syscalls.h
===================================================================
--- uClibc/libc/sysdeps/linux/arm/bits/syscalls.h (revision 15970)
+++ uClibc/libc/sysdeps/linux/arm/bits/syscalls.h (working copy)
@@ -9,17 +9,14 @@
* programs. */
#include <bits/sysnum.h>
+#define SYS_ify(syscall_name) (__NR_##syscall_name)
+
/*
Some of the sneaky macros in the code were taken from
glibc-2.3.2/sysdeps/unix/sysv/linux/arm/sysdep.h
*/
-#ifndef __ASSEMBLER__
-
-#include <errno.h>
-
-#define SYS_ify(syscall_name) (__NR_##syscall_name)
-
+#ifdef __ASSEMBLER__
/* Call a given syscall, with arguments loaded. For EABI, we must
save and restore r7 for the syscall number. Unlike the DO_CALL
macro in glibc, this macro does not load syscall arguments. */
@@ -34,8 +31,10 @@
#define DO_CALL(syscall_name) \
swi SYS_ify (syscall_name);
#endif
-#else
+#else /* __ASSEMBLER__ */
+#include <errno.h>
+
#undef _syscall0
#define _syscall0(type,name) \
type name(void) \
@@ -114,10 +113,10 @@
#define INTERNAL_SYSCALL(name, err, nr, args...) \
({unsigned int _sys_result; \
{ \
- register int _a1 asm ("r0"), _nr asm ("r7"); \
+ register int _a1 __asm__ ("r0"), _nr asm ("r7"); \
LOAD_ARGS_##nr (args) \
_nr = SYS_ify(name); \
- asm volatile ("swi 0x0 @ syscall " #name \
+ __asm__ __volatile__ ("swi 0x0 @ syscall " #name \
: "=r" (_a1) \
: "r" (_nr) ASM_ARGS_##nr \
: "memory"); \
@@ -129,9 +128,9 @@
#define INTERNAL_SYSCALL(name, err, nr, args...) \
({ unsigned int _sys_result; \
{ \
- register int _a1 asm ("a1"); \
+ register int _a1 __asm__ ("a1"); \
LOAD_ARGS_##nr (args) \
- asm volatile ("swi %1 @ syscall " #name \
+ __asm__ __volatile__ ("swi %1 @ syscall " #name \
: "=r" (_a1) \
: "i" (SYS_ify(name)) ASM_ARGS_##nr \
: "memory"); \
@@ -147,10 +146,10 @@
#define INTERNAL_SYSCALL(name, err, nr, args...) \
({ unsigned int _sys_result; \
{ \
- register int _a1 asm ("a1"); \
+ register int _a1 __asm__ ("a1"); \
LOAD_ARGS_##nr (args) \
- register int _r7 asm ("r7") = (int) (SYS_ify(name)); \
- asm volatile ("swi 0 @ syscall " #name \
+ register int _r7 __asm__ ("r7") = (int) (SYS_ify(name)); \
+ __asm__ __volatile__ ("swi 0 @ syscall " #name \
: "=r" (_a1) \
: "r" (_r7) ASM_ARGS_##nr \
: "memory"); \
@@ -165,10 +164,10 @@
#define INTERNAL_SYSCALL(name, err, nr, args...) \
({ unsigned int _sys_result; \
{ \
- register int _a1 asm ("a1"); \
+ register int _a1 __asm__ ("a1"); \
LOAD_ARGS_##nr (args) \
- register int _v3 asm ("v3") = (int) (SYS_ify(name)); \
- asm volatile ("push {r7}\n" \
+ register int _v3 __asm__ ("v3") = (int) (SYS_ify(name)); \
+ __asm__ __volatile__ ("push {r7}\n" \
"\tmov r7, v3\n" \
"\tswi 0 @ syscall " #name "\n" \
"\tpop {r7}" \
@@ -196,30 +195,30 @@
LOAD_ARGS_0 ()
#define ASM_ARGS_1 ASM_ARGS_0, "r" (_a1)
#define LOAD_ARGS_2(a1, a2) \
- register int _a2 asm ("a2") = (int) (a2); \
+ register int _a2 __asm__ ("a2") = (int) (a2); \
LOAD_ARGS_1 (a1)
#define ASM_ARGS_2 ASM_ARGS_1, "r" (_a2)
#define LOAD_ARGS_3(a1, a2, a3) \
- register int _a3 asm ("a3") = (int) (a3); \
+ register int _a3 __asm__ ("a3") = (int) (a3); \
LOAD_ARGS_2 (a1, a2)
#define ASM_ARGS_3 ASM_ARGS_2, "r" (_a3)
#define LOAD_ARGS_4(a1, a2, a3, a4) \
- register int _a4 asm ("a4") = (int) (a4); \
+ register int _a4 __asm__ ("a4") = (int) (a4); \
LOAD_ARGS_3 (a1, a2, a3)
#define ASM_ARGS_4 ASM_ARGS_3, "r" (_a4)
#define LOAD_ARGS_5(a1, a2, a3, a4, a5) \
- register int _v1 asm ("v1") = (int) (a5); \
+ register int _v1 __asm__ ("v1") = (int) (a5); \
LOAD_ARGS_4 (a1, a2, a3, a4)
#define ASM_ARGS_5 ASM_ARGS_4, "r" (_v1)
#define LOAD_ARGS_6(a1, a2, a3, a4, a5, a6) \
- register int _v2 asm ("v2") = (int) (a6); \
+ register int _v2 __asm__ ("v2") = (int) (a6); \
LOAD_ARGS_5 (a1, a2, a3, a4, a5)
#define ASM_ARGS_6 ASM_ARGS_5, "r" (_v2)
#define LOAD_ARGS_7(a1, a2, a3, a4, a5, a6, a7) \
- register int _v3 asm ("v3") = (int) (a7); \
+ register int _v3 __asm__ ("v3") = (int) (a7); \
LOAD_ARGS_6 (a1, a2, a3, a4, a5, a6)
#define ASM_ARGS_7 ASM_ARGS_6, "r" (_v3)
-#endif /* __ASSEMBLER__ */
+#endif /* !__ASSEMBLER__ */
#endif /* _BITS_SYSCALLS_H */
More information about the uClibc
mailing list