Introduce arch-specific define HAVE_ARCH_OLD_MMAP

* linux/arch_defs.h: New file.
* linux/aarch64/arch_defs.h: New file.  Define HAVE_ARCH_OLD_MMAP.
* linux/arm/arch_defs.h: Likewise.
* linux/i386/arch_defs.h: Likewise.
* linux/m68k/arch_defs.h: Likewise.
* linux/s390/arch_defs.h: Likewise.
* linux/s390x/arch_defs.h: Likewise.
* linux/x32/arch_defs.h: Likewise.
* linux/x86_64/arch_defs.h: Likewise.
* Makefile.am (EXTRA_DIST): Add them.
* defs.h: Include "arch_defs.h"
* mem.c: Replace condition for SYS_FUNC(old_mmap) with #ifdef
HAVE_ARCH_OLD_MMAP.

Suggested-by: Dmitry V. Levin <ldv@altlinux.org>
This commit is contained in:
Eugene Syromyatnikov 2018-01-17 03:18:23 +01:00 committed by Dmitry V. Levin
parent 16046f7773
commit 408ce203da
12 changed files with 21 additions and 5 deletions

View File

@ -386,6 +386,7 @@ EXTRA_DIST = \
linux/32/syscallent.h \
linux/64/ioctls_inc.h \
linux/64/syscallent.h \
linux/aarch64/arch_defs.h \
linux/aarch64/arch_regs.c \
linux/aarch64/arch_regs.h \
linux/aarch64/arch_rt_sigframe.c\
@ -431,9 +432,11 @@ EXTRA_DIST = \
linux/arc/set_error.c \
linux/arc/set_scno.c \
linux/arc/syscallent.h \
linux/arch_defs.h \
linux/arch_kvm.c \
linux/arch_regs.h \
linux/arch_sigreturn.c \
linux/arm/arch_defs.h \
linux/arm/arch_regs.c \
linux/arm/arch_regs.h \
linux/arm/arch_rt_sigframe.c \
@ -515,6 +518,7 @@ EXTRA_DIST = \
linux/hppa/signalent.h \
linux/hppa/syscallent.h \
linux/i386/arch_kvm.c \
linux/i386/arch_defs.h \
linux/i386/arch_regs.c \
linux/i386/arch_regs.h \
linux/i386/arch_rt_sigframe.c \
@ -545,6 +549,7 @@ EXTRA_DIST = \
linux/ia64/syscallent.h \
linux/ia64/userent.h \
linux/inet_diag.h \
linux/m68k/arch_defs.h \
linux/m68k/arch_regs.c \
linux/m68k/arch_regs.h \
linux/m68k/arch_rt_sigframe.c \
@ -685,6 +690,7 @@ EXTRA_DIST = \
linux/riscv/syscallent.h \
linux/riscv/syscallent1.h \
linux/rt_sigframe.h \
linux/s390/arch_defs.h \
linux/s390/arch_regs.c \
linux/s390/arch_regs.h \
linux/s390/arch_rt_sigframe.c \
@ -701,6 +707,7 @@ EXTRA_DIST = \
linux/s390/userent.h \
linux/s390/userent0.h \
linux/s390/userent1.h \
linux/s390x/arch_defs.h \
linux/s390x/arch_regs.c \
linux/s390x/arch_regs.h \
linux/s390x/arch_rt_sigframe.c \
@ -810,6 +817,7 @@ EXTRA_DIST = \
linux/unix_diag.h \
linux/userent.h \
linux/userent0.h \
linux/x32/arch_defs.h \
linux/x32/arch_kvm.c \
linux/x32/arch_regs.c \
linux/x32/arch_regs.h \
@ -830,6 +838,7 @@ EXTRA_DIST = \
linux/x32/syscallent.h \
linux/x32/syscallent1.h \
linux/x32/userent.h \
linux/x86_64/arch_defs.h \
linux/x86_64/arch_kvm.c \
linux/x86_64/arch_regs.c \
linux/x86_64/arch_regs.h \

1
defs.h
View File

@ -53,6 +53,7 @@
#include <time.h>
#include <sys/time.h>
#include "arch_defs.h"
#include "error_prints.h"
#include "gcc_compat.h"
#include "kernel_types.h"

View File

@ -0,0 +1 @@
#define HAVE_ARCH_OLD_MMAP 1

1
linux/arch_defs.h Normal file
View File

@ -0,0 +1 @@
/* Fallback file for arch-specific definitions */

1
linux/arm/arch_defs.h Normal file
View File

@ -0,0 +1 @@
#define HAVE_ARCH_OLD_MMAP 1

1
linux/i386/arch_defs.h Normal file
View File

@ -0,0 +1 @@
#define HAVE_ARCH_OLD_MMAP 1

1
linux/m68k/arch_defs.h Normal file
View File

@ -0,0 +1 @@
#define HAVE_ARCH_OLD_MMAP 1

1
linux/s390/arch_defs.h Normal file
View File

@ -0,0 +1 @@
#define HAVE_ARCH_OLD_MMAP 1

1
linux/s390x/arch_defs.h Normal file
View File

@ -0,0 +1 @@
#define HAVE_ARCH_OLD_MMAP 1

1
linux/x32/arch_defs.h Normal file
View File

@ -0,0 +1 @@
#define HAVE_ARCH_OLD_MMAP 1

1
linux/x86_64/arch_defs.h Normal file
View File

@ -0,0 +1 @@
#define HAVE_ARCH_OLD_MMAP 1

7
mem.c
View File

@ -107,10 +107,7 @@ print_mmap(struct tcb *tcp, kernel_ulong_t *u_arg, unsigned long long offset)
* Confused? Me too!
*/
#if defined AARCH64 || defined ARM \
|| defined I386 || defined X86_64 || defined X32 \
|| defined M68K \
|| defined S390 || defined S390X
#ifdef HAVE_ARCH_OLD_MMAP
/* Params are pointed to by u_arg[0], offset is in bytes */
SYS_FUNC(old_mmap)
{
@ -131,7 +128,7 @@ SYS_FUNC(old_mmap)
return RVAL_DECODED | RVAL_HEX;
}
#endif /* old_mmap architectures */
#endif /* HAVE_ARCH_OLD_MMAP */
#ifdef S390
/* Params are pointed to by u_arg[0], offset is in pages */