aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Waterman <andrew@sifive.com>2016-11-13 17:52:34 -0800
committerAndrew Waterman <andrew@sifive.com>2016-11-13 17:52:34 -0800
commit8039c6cacb5f4627b6085cda1e5c8db8ef70b9d6 (patch)
tree8c408763a0feda5a7467f996faf619cfb6beeb55
parent55ce524e7407bde35ca7a270de10caf0f73fb9da (diff)
downloadriscv-pk-8039c6cacb5f4627b6085cda1e5c8db8ef70b9d6.zip
riscv-pk-8039c6cacb5f4627b6085cda1e5c8db8ef70b9d6.tar.gz
riscv-pk-8039c6cacb5f4627b6085cda1e5c8db8ef70b9d6.tar.bz2
For RV32, mmap offset is in 4 KiB increments
-rw-r--r--pk/syscall.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/pk/syscall.c b/pk/syscall.c
index c5f650c..e6b2454 100644
--- a/pk/syscall.c
+++ b/pk/syscall.c
@@ -320,8 +320,12 @@ int sys_getuid()
uintptr_t sys_mmap(uintptr_t addr, size_t length, int prot, int flags, int fd, off_t offset)
{
- uintptr_t ret = do_mmap(addr, length, prot, flags, fd, offset);
- return ret;
+#ifdef __riscv32
+ if (offset != (offset << 12 >> 12))
+ return -ENXIO;
+ offset <<= 12;
+#endif
+ return do_mmap(addr, length, prot, flags, fd, offset);
}
int sys_munmap(uintptr_t addr, size_t length)