[compiler-rt] r266295 - [sanitizer] [SystemZ] Implement internal_mmap.
Kostya Serebryany via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 15 09:48:31 PDT 2016
I'd prefer if you could move this and similar pieces of code into
separate SystemZ-specific
file(s).
The sanitizer run-time is already a hairy ball of #ifdefs, let's try not to
make it worse.
On Thu, Apr 14, 2016 at 5:51 AM, Marcin Koscielnicki via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> Author: koriakin
> Date: Thu Apr 14 07:51:45 2016
> New Revision: 266295
>
> URL: http://llvm.org/viewvc/llvm-project?rev=266295&view=rev
> Log:
> [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
>
> Modified:
> compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
>
> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc?rev=266295&r1=266294&r2=266295&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc (original)
> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc Thu Apr 14
> 07:51:45 2016
> @@ -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
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160415/00b05ea1/attachment.html>
More information about the llvm-commits
mailing list