diff options
author | Marcin Koscielnicki <koriakin@0x04.net> | 2016-04-14 12:51:45 +0000 |
---|---|---|
committer | Marcin Koscielnicki <koriakin@0x04.net> | 2016-04-14 12:51:45 +0000 |
commit | 545e507c438ff87d44ec873abda9b4379f2bf724 (patch) | |
tree | 4c0527cb9bfb5bc93e4040e9dd40f8b53769760a /compiler-rt/lib | |
parent | 17b8b0625252be3d14609b248c6701fe0d10dbb8 (diff) | |
download | bcm5719-llvm-545e507c438ff87d44ec873abda9b4379f2bf724.tar.gz bcm5719-llvm-545e507c438ff87d44ec873abda9b4379f2bf724.zip |
[sanitizer] [SystemZ] Implement internal_mmap.
mmap on s390 is quite a special snowflake: since it has too many
parameters to pass them in registers, it passes a pointer to a struct
with all the parameters instead.
Differential Revision: http://reviews.llvm.org/D18889
llvm-svn: 266295
Diffstat (limited to 'compiler-rt/lib')
-rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_linux.cc | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc index e22d435cc27..b4f46bd225f 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc @@ -112,7 +112,32 @@ namespace __sanitizer { // --------------- sanitizer_libc.h uptr internal_mmap(void *addr, uptr length, int prot, int flags, int fd, OFF_T offset) { -#if SANITIZER_FREEBSD || SANITIZER_LINUX_USES_64BIT_SYSCALLS +#ifdef __s390__ + struct s390_mmap_params { + unsigned long addr; + unsigned long length; + unsigned long prot; + unsigned long flags; + unsigned long fd; + unsigned long offset; + } params = { + (unsigned long)addr, + (unsigned long)length, + (unsigned long)prot, + (unsigned long)flags, + (unsigned long)fd, +# ifdef __s390x__ + (unsigned long)offset, +# else + (unsigned long)(offset / 4096), +# endif + }; +# ifdef __s390x__ + return internal_syscall(SYSCALL(mmap), ¶ms); +# else + return internal_syscall(SYSCALL(mmap2), ¶ms); +# endif +#elif SANITIZER_FREEBSD || SANITIZER_LINUX_USES_64BIT_SYSCALLS return internal_syscall(SYSCALL(mmap), (uptr)addr, length, prot, flags, fd, offset); #else |