-/* Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1999,2000,01,02 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 1999.
int saved_errno = errno;
# endif
void *result;
- __ptrvalue (result) = INLINE_SYSCALL (mmap2, 6, __ptrvalue (addr), len,
- prot, flags, fd,
- (off_t) (offset >> PAGE_SHIFT));
+ __ptrvalue (result)
+ = (void *) INLINE_SYSCALL (mmap2, 6, __ptrvalue (addr), len,
+ prot, flags, fd,
+ (off_t) (offset >> PAGE_SHIFT));
# if __BOUNDED_POINTERS__
__ptrlow (result) = __ptrvalue (result);
__ptrhigh (result) = __ptrvalue (result) + len;
-/* Copyright (C) 1992,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
+/* Copyright (C) 1992,97,98,99,2000,01,02 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
# define SYS_ify(syscall_name) __NR_/**/syscall_name
#endif
+#ifndef __ASSEMBLER__
+
+# include <errno.h>
+
+# undef INLINE_SYSCALL
+# define INLINE_SYSCALL(name, nr, args...) \
+ ({ \
+ long ret, err; \
+ LOADARGS_##nr(name, args); \
+ __asm__ ("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 LOADARGS_0(name) \
+ register long r0 __asm__ ("r0") = __NR_##name; \
+ register long r3 __asm__ ("r3")
+# define LOADARGS_1(name, arg1) \
+ LOADARGS_0(name) = (long) (arg1)
+# define LOADARGS_2(name, arg1, arg2) \
+ LOADARGS_1(name, arg1); \
+ register long r4 __asm__ ("r4") = (long) (arg2)
+# define LOADARGS_3(name, arg1, arg2, arg3) \
+ LOADARGS_2(name, arg1, arg2); \
+ register long r5 __asm__ ("r5") = (long) (arg3)
+# define LOADARGS_4(name, arg1, arg2, arg3, arg4) \
+ LOADARGS_3(name, arg1, arg2, arg3); \
+ register long r6 __asm__ ("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)
+# 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)
+
+# 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)
+
+#endif /* __ASSEMBLER__ */
+
+
#endif /* linux/powerpc/sysdep.h */