提交 b5bbe797 编写于 作者: R Rich Felker

add framework for mmap2 syscall unit to vary by arch

上级 cc54f0ae
...@@ -8,6 +8,10 @@ ...@@ -8,6 +8,10 @@
#define SYSCALL_RLIM_INFINITY (~0ULL) #define SYSCALL_RLIM_INFINITY (~0ULL)
#endif #endif
#ifndef SYSCALL_MMAP2_UNIT
#define SYSCALL_MMAP2_UNIT 4096ULL
#endif
#ifndef __scc #ifndef __scc
#define __scc(X) ((long) (X)) #define __scc(X) ((long) (X))
typedef long syscall_arg_t; typedef long syscall_arg_t;
......
...@@ -11,7 +11,8 @@ static void dummy0(void) { } ...@@ -11,7 +11,8 @@ static void dummy0(void) { }
weak_alias(dummy1, __vm_lock); weak_alias(dummy1, __vm_lock);
weak_alias(dummy0, __vm_unlock); weak_alias(dummy0, __vm_unlock);
#define OFF_MASK ((-0x2000ULL << (8*sizeof(long)-1)) | 0xfff) #define UNIT SYSCALL_MMAP2_UNIT
#define OFF_MASK ((-0x2000ULL << (8*sizeof(long)-1)) | (UNIT-1))
void *__mmap(void *start, size_t len, int prot, int flags, int fd, off_t off) void *__mmap(void *start, size_t len, int prot, int flags, int fd, off_t off)
{ {
...@@ -27,7 +28,7 @@ void *__mmap(void *start, size_t len, int prot, int flags, int fd, off_t off) ...@@ -27,7 +28,7 @@ void *__mmap(void *start, size_t len, int prot, int flags, int fd, off_t off)
} }
if (flags & MAP_FIXED) __vm_lock(-1); if (flags & MAP_FIXED) __vm_lock(-1);
#ifdef SYS_mmap2 #ifdef SYS_mmap2
ret = (void *)syscall(SYS_mmap2, start, len, prot, flags, fd, off>>12); ret = (void *)syscall(SYS_mmap2, start, len, prot, flags, fd, off/UNIT);
#else #else
ret = (void *)syscall(SYS_mmap, start, len, prot, flags, fd, off); ret = (void *)syscall(SYS_mmap, start, len, prot, flags, fd, off);
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册