From 6334e558ab33ee1e54ed33740881a2798c5915c2 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Wed, 21 Jan 2004 23:27:48 +0000 Subject: Split up syscalls.c, since it had grown to be quite large and ugly. -Erik --- libc/sysdeps/linux/powerpc/_mmap.c | 48 -------------------------------------- libc/sysdeps/linux/powerpc/ioctl.c | 4 +++- libc/sysdeps/linux/powerpc/mmap.c | 48 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 49 deletions(-) delete mode 100644 libc/sysdeps/linux/powerpc/_mmap.c create mode 100644 libc/sysdeps/linux/powerpc/mmap.c (limited to 'libc/sysdeps/linux/powerpc') diff --git a/libc/sysdeps/linux/powerpc/_mmap.c b/libc/sysdeps/linux/powerpc/_mmap.c deleted file mode 100644 index ec4bfd1f9..000000000 --- a/libc/sysdeps/linux/powerpc/_mmap.c +++ /dev/null @@ -1,48 +0,0 @@ - -#include -#include -#include -#include - -#define __syscall_clobbers \ - "r9", "r10", "r11", "r12" -#define __syscall_return(type) \ - return (__sc_err & 0x10000000 ? errno = __sc_ret, __sc_ret = -1 : 0), \ - (type) __sc_ret - -void * mmap(void *start, size_t length, int prot, int flags, int fd, - off_t offset) -{ - unsigned long __sc_ret, __sc_err; - register unsigned long __sc_0 __asm__ ("r0"); - register unsigned long __sc_3 __asm__ ("r3"); - register unsigned long __sc_4 __asm__ ("r4"); - register unsigned long __sc_5 __asm__ ("r5"); - register unsigned long __sc_6 __asm__ ("r6"); - register unsigned long __sc_7 __asm__ ("r7"); - register unsigned long __sc_8 __asm__ ("r8"); - - __sc_3 = (unsigned long) start; - __sc_4 = (unsigned long) length; - __sc_5 = (unsigned long) prot; - __sc_6 = (unsigned long) flags; - __sc_7 = (unsigned long) fd; - __sc_8 = (unsigned long) offset; - __sc_0 = __NR_mmap; - __asm__ __volatile__ - ("sc \n\t" - "mfcr %1 " - : "=&r" (__sc_3), "=&r" (__sc_0) - : "0" (__sc_3), "1" (__sc_0), - "r" (__sc_4), - "r" (__sc_5), - "r" (__sc_6), - "r" (__sc_7), - "r" (__sc_8) - : __syscall_clobbers); - __sc_ret = __sc_3; - __sc_err = __sc_0; - - __syscall_return (void *); -} - diff --git a/libc/sysdeps/linux/powerpc/ioctl.c b/libc/sysdeps/linux/powerpc/ioctl.c index 36a0d9144..30ed1d434 100644 --- a/libc/sysdeps/linux/powerpc/ioctl.c +++ b/libc/sysdeps/linux/powerpc/ioctl.c @@ -24,7 +24,9 @@ /* The user-visible size of struct termios has changed. Catch ioctl calls using the new-style struct termios, and translate them to old-style. */ -extern int __syscall_ioctl (int fd, unsigned long int request, ...); +#define __NR___syscall_ioctl __NR_ioctl +_syscall3(int, __syscall_ioctl, int, fd, unsigned long int, request, void *, arg); + int ioctl (int fd, unsigned long int request, ...) { diff --git a/libc/sysdeps/linux/powerpc/mmap.c b/libc/sysdeps/linux/powerpc/mmap.c new file mode 100644 index 000000000..ec4bfd1f9 --- /dev/null +++ b/libc/sysdeps/linux/powerpc/mmap.c @@ -0,0 +1,48 @@ + +#include +#include +#include +#include + +#define __syscall_clobbers \ + "r9", "r10", "r11", "r12" +#define __syscall_return(type) \ + return (__sc_err & 0x10000000 ? errno = __sc_ret, __sc_ret = -1 : 0), \ + (type) __sc_ret + +void * mmap(void *start, size_t length, int prot, int flags, int fd, + off_t offset) +{ + unsigned long __sc_ret, __sc_err; + register unsigned long __sc_0 __asm__ ("r0"); + register unsigned long __sc_3 __asm__ ("r3"); + register unsigned long __sc_4 __asm__ ("r4"); + register unsigned long __sc_5 __asm__ ("r5"); + register unsigned long __sc_6 __asm__ ("r6"); + register unsigned long __sc_7 __asm__ ("r7"); + register unsigned long __sc_8 __asm__ ("r8"); + + __sc_3 = (unsigned long) start; + __sc_4 = (unsigned long) length; + __sc_5 = (unsigned long) prot; + __sc_6 = (unsigned long) flags; + __sc_7 = (unsigned long) fd; + __sc_8 = (unsigned long) offset; + __sc_0 = __NR_mmap; + __asm__ __volatile__ + ("sc \n\t" + "mfcr %1 " + : "=&r" (__sc_3), "=&r" (__sc_0) + : "0" (__sc_3), "1" (__sc_0), + "r" (__sc_4), + "r" (__sc_5), + "r" (__sc_6), + "r" (__sc_7), + "r" (__sc_8) + : __syscall_clobbers); + __sc_ret = __sc_3; + __sc_err = __sc_0; + + __syscall_return (void *); +} + -- cgit v1.2.3