From c5b7f28ab5791bd321a63b4a56ea5199fe2d9615 Mon Sep 17 00:00:00 2001 From: Bernd Schmidt Date: Thu, 22 Nov 2007 17:28:22 +0000 Subject: Add Blackfin specific mmap implementation using sys_mmap2. --- libc/sysdeps/linux/bfin/Makefile.arch | 2 +- libc/sysdeps/linux/bfin/mmap.c | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 libc/sysdeps/linux/bfin/mmap.c (limited to 'libc/sysdeps/linux/bfin') diff --git a/libc/sysdeps/linux/bfin/Makefile.arch b/libc/sysdeps/linux/bfin/Makefile.arch index 7a428b380..fa62cc610 100644 --- a/libc/sysdeps/linux/bfin/Makefile.arch +++ b/libc/sysdeps/linux/bfin/Makefile.arch @@ -5,7 +5,7 @@ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # -CSRC := brk.c bsdsetjmp.c clone.c syscall.c +CSRC := brk.c bsdsetjmp.c clone.c syscall.c mmap.c SSRC := __longjmp.S setjmp.S bsd-_setjmp.S vfork.S diff --git a/libc/sysdeps/linux/bfin/mmap.c b/libc/sysdeps/linux/bfin/mmap.c new file mode 100644 index 000000000..41140df0e --- /dev/null +++ b/libc/sysdeps/linux/bfin/mmap.c @@ -0,0 +1,24 @@ +/* Use new style mmap for bfin */ + +#include +#include +#include +#include +#include + +#define __NR___syscall_mmap2 __NR_mmap2 +inline _syscall6(__ptr_t, __syscall_mmap2, __ptr_t, addr, + size_t, len, int, prot, int, flags, int, fd, off_t, offset); + +libc_hidden_proto(mmap) + +__ptr_t mmap(__ptr_t addr, size_t len, int prot, + int flags, int fd, __off_t offset) +{ + if (offset & ~PAGE_MASK) { + return NULL; + } + return __syscall_mmap2(addr, len, prot, flags, fd, offset >> PAGE_SHIFT); +} + +libc_hidden_def(mmap) -- cgit v1.2.3