2 * (c) 2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
3 * Alexander Warg <warg@os.inf.tu-dresden.de>
4 * economic rights: Technische Universität Dresden (Germany)
5 * This file is part of TUD:OS and distributed under the terms of the
6 * GNU Lesser General Public License 2.1.
7 * Please see the COPYING-LGPL-2.1 file for details.
10 #include <l4/sys/compiler.h>
12 #include <l4/re/dataspace>
14 #include <l4/re/util/cap_alloc>
19 #include <l4/l4re_vfs/backend>
22 #define L4B_REDIRECT(ret, func, ptlist, plist) \
23 ret func ptlist L4_NOTHROW \
25 ret r = L4B(func plist); \
29 void *mmap2(void *addr, size_t length, int prot, int flags,
30 int fd, off_t pgoffset) L4_NOTHROW;
31 void *mmap2(void *addr, size_t length, int prot, int flags,
32 int fd, off_t pgoffset) L4_NOTHROW
35 int r = L4B(mmap2(addr, length, prot, flags, fd, pgoffset, &resptr));
46 /* Other versions of mmap */
47 void *mmap64(void *addr, size_t length, int prot, int flags,
48 int fd, off64_t offset) L4_NOTHROW
50 if (offset & ~L4_PAGEMASK)
55 return mmap2(addr, length, prot, flags, fd, offset >> L4_PAGESHIFT);
58 void *mmap(void *addr, size_t length, int prot, int flags,
59 int fd, off_t offset) L4_NOTHROW
61 return mmap64(addr, length, prot, flags, fd, offset);
64 L4B_REDIRECT_2(int, munmap, void*, size_t)
65 L4B_REDIRECT_3(int, mprotect, void *, size_t, int);
66 L4B_REDIRECT_3(int, madvise, void *, size_t, int);
67 L4B_REDIRECT_3(int, msync, void *, size_t, int);
69 void *mremap(void *old_addr, size_t old_size, size_t new_size,
70 int flags, ...) L4_NOTHROW
73 if (flags & MREMAP_FIXED)
77 resptr = va_arg(a, void *);
81 int r = L4B(mremap(old_addr, old_size, new_size, flags, &resptr));