qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Alex Bennée" <alex.bennee@linaro.org>
Subject: [PULL 23/47] linux-user: Split TARGET_MAP_* out of syscall_defs.h
Date: Sat, 15 Jul 2023 14:52:53 +0100	[thread overview]
Message-ID: <20230715135317.7219-24-richard.henderson@linaro.org> (raw)
In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org>

Move the values into the per-target target_mman.h headers

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230707204054.8792-7-richard.henderson@linaro.org>
---
 linux-user/alpha/target_mman.h   | 13 +++++
 linux-user/generic/target_mman.h | 54 ++++++++++++++++++++
 linux-user/hppa/target_mman.h    | 10 ++++
 linux-user/mips/target_mman.h    | 16 ++++++
 linux-user/mips64/target_mman.h  |  2 +-
 linux-user/ppc/target_mman.h     |  8 +++
 linux-user/sparc/target_mman.h   |  9 ++++
 linux-user/syscall_defs.h        | 85 +-------------------------------
 linux-user/xtensa/target_mman.h  | 16 ++++++
 9 files changed, 128 insertions(+), 85 deletions(-)

diff --git a/linux-user/alpha/target_mman.h b/linux-user/alpha/target_mman.h
index 051544f5ab..6bb03e7336 100644
--- a/linux-user/alpha/target_mman.h
+++ b/linux-user/alpha/target_mman.h
@@ -1,6 +1,19 @@
 #ifndef ALPHA_TARGET_MMAN_H
 #define ALPHA_TARGET_MMAN_H
 
+#define TARGET_MAP_ANONYMOUS            0x10
+#define TARGET_MAP_FIXED                0x100
+#define TARGET_MAP_GROWSDOWN            0x01000
+#define TARGET_MAP_DENYWRITE            0x02000
+#define TARGET_MAP_EXECUTABLE           0x04000
+#define TARGET_MAP_LOCKED               0x08000
+#define TARGET_MAP_NORESERVE            0x10000
+#define TARGET_MAP_POPULATE             0x20000
+#define TARGET_MAP_NONBLOCK             0x40000
+#define TARGET_MAP_STACK                0x80000
+#define TARGET_MAP_HUGETLB              0x100000
+#define TARGET_MAP_FIXED_NOREPLACE      0x200000
+
 #define TARGET_MADV_DONTNEED 6
 
 #define TARGET_MS_ASYNC 1
diff --git a/linux-user/generic/target_mman.h b/linux-user/generic/target_mman.h
index 32bf1a52d0..7b888fb7f8 100644
--- a/linux-user/generic/target_mman.h
+++ b/linux-user/generic/target_mman.h
@@ -1,6 +1,60 @@
 #ifndef LINUX_USER_TARGET_MMAN_H
 #define LINUX_USER_TARGET_MMAN_H
 
+/* These are defined in linux/mmap.h */
+#define TARGET_MAP_SHARED               0x01
+#define TARGET_MAP_PRIVATE              0x02
+#define TARGET_MAP_SHARED_VALIDATE      0x03
+
+/* 0x0100 - 0x4000 flags are defined in asm-generic/mman.h */
+#ifndef TARGET_MAP_GROWSDOWN
+#define TARGET_MAP_GROWSDOWN            0x0100
+#endif
+#ifndef TARGET_MAP_DENYWRITE
+#define TARGET_MAP_DENYWRITE            0x0800
+#endif
+#ifndef TARGET_MAP_EXECUTABLE
+#define TARGET_MAP_EXECUTABLE           0x1000
+#endif
+#ifndef TARGET_MAP_LOCKED
+#define TARGET_MAP_LOCKED               0x2000
+#endif
+#ifndef TARGET_MAP_NORESERVE
+#define TARGET_MAP_NORESERVE            0x4000
+#endif
+
+/* Other MAP flags are defined in asm-generic/mman-common.h */
+#ifndef TARGET_MAP_TYPE
+#define TARGET_MAP_TYPE                 0x0f
+#endif
+#ifndef TARGET_MAP_FIXED
+#define TARGET_MAP_FIXED                0x10
+#endif
+#ifndef TARGET_MAP_ANONYMOUS
+#define TARGET_MAP_ANONYMOUS            0x20
+#endif
+#ifndef TARGET_MAP_POPULATE
+#define TARGET_MAP_POPULATE             0x008000
+#endif
+#ifndef TARGET_MAP_NONBLOCK
+#define TARGET_MAP_NONBLOCK             0x010000
+#endif
+#ifndef TARGET_MAP_STACK
+#define TARGET_MAP_STACK                0x020000
+#endif
+#ifndef TARGET_MAP_HUGETLB
+#define TARGET_MAP_HUGETLB              0x040000
+#endif
+#ifndef TARGET_MAP_SYNC
+#define TARGET_MAP_SYNC                 0x080000
+#endif
+#ifndef TARGET_MAP_FIXED_NOREPLACE
+#define TARGET_MAP_FIXED_NOREPLACE      0x100000
+#endif
+#ifndef TARGET_MAP_UNINITIALIZED
+#define TARGET_MAP_UNINITIALIZED        0x4000000
+#endif
+
 #ifndef TARGET_MADV_NORMAL
 #define TARGET_MADV_NORMAL 0
 #endif
diff --git a/linux-user/hppa/target_mman.h b/linux-user/hppa/target_mman.h
index f9b6b97032..97f87d042a 100644
--- a/linux-user/hppa/target_mman.h
+++ b/linux-user/hppa/target_mman.h
@@ -1,6 +1,16 @@
 #ifndef HPPA_TARGET_MMAN_H
 #define HPPA_TARGET_MMAN_H
 
+#define TARGET_MAP_TYPE                 0x2b
+#define TARGET_MAP_FIXED                0x04
+#define TARGET_MAP_ANONYMOUS            0x10
+#define TARGET_MAP_GROWSDOWN            0x8000
+#define TARGET_MAP_POPULATE             0x10000
+#define TARGET_MAP_NONBLOCK             0x20000
+#define TARGET_MAP_STACK                0x40000
+#define TARGET_MAP_HUGETLB              0x80000
+#define TARGET_MAP_UNINITIALIZED        0
+
 #define TARGET_MADV_MERGEABLE 65
 #define TARGET_MADV_UNMERGEABLE 66
 #define TARGET_MADV_HUGEPAGE 67
diff --git a/linux-user/mips/target_mman.h b/linux-user/mips/target_mman.h
index e7ba6070fe..cd566c24b6 100644
--- a/linux-user/mips/target_mman.h
+++ b/linux-user/mips/target_mman.h
@@ -1 +1,17 @@
+#ifndef MIPS_TARGET_MMAN_H
+#define MIPS_TARGET_MMAN_H
+
+#define TARGET_MAP_NORESERVE            0x0400
+#define TARGET_MAP_ANONYMOUS            0x0800
+#define TARGET_MAP_GROWSDOWN            0x1000
+#define TARGET_MAP_DENYWRITE            0x2000
+#define TARGET_MAP_EXECUTABLE           0x4000
+#define TARGET_MAP_LOCKED               0x8000
+#define TARGET_MAP_POPULATE             0x10000
+#define TARGET_MAP_NONBLOCK             0x20000
+#define TARGET_MAP_STACK                0x40000
+#define TARGET_MAP_HUGETLB              0x80000
+
 #include "../generic/target_mman.h"
+
+#endif
diff --git a/linux-user/mips64/target_mman.h b/linux-user/mips64/target_mman.h
index e7ba6070fe..7bdc47d902 100644
--- a/linux-user/mips64/target_mman.h
+++ b/linux-user/mips64/target_mman.h
@@ -1 +1 @@
-#include "../generic/target_mman.h"
+#include "../mips/target_mman.h"
diff --git a/linux-user/ppc/target_mman.h b/linux-user/ppc/target_mman.h
index e7ba6070fe..67cc218f2e 100644
--- a/linux-user/ppc/target_mman.h
+++ b/linux-user/ppc/target_mman.h
@@ -1 +1,9 @@
+#ifndef PPC_TARGET_MMAN_H
+#define PPC_TARGET_MMAN_H
+
+#define TARGET_MAP_NORESERVE            0x40
+#define TARGET_MAP_LOCKED               0x80
+
 #include "../generic/target_mman.h"
+
+#endif
diff --git a/linux-user/sparc/target_mman.h b/linux-user/sparc/target_mman.h
index e7ba6070fe..9bad99c852 100644
--- a/linux-user/sparc/target_mman.h
+++ b/linux-user/sparc/target_mman.h
@@ -1 +1,10 @@
+#ifndef SPARC_TARGET_MMAN_H
+#define SPARC_TARGET_MMAN_H
+
+#define TARGET_MAP_NORESERVE           0x40
+#define TARGET_MAP_LOCKED              0x100
+#define TARGET_MAP_GROWSDOWN           0x0200
+
 #include "../generic/target_mman.h"
+
+#endif
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index c8ffb4f785..041105b7a7 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -1238,90 +1238,7 @@ struct target_winsize {
 #define TARGET_PROT_MTE         0x20
 #endif
 
-/* Common */
-#define TARGET_MAP_SHARED       0x01            /* Share changes */
-#define TARGET_MAP_PRIVATE      0x02            /* Changes are private */
-#if defined(TARGET_HPPA)
-#define TARGET_MAP_TYPE         0x03            /* Mask for type of mapping */
-#else
-#define TARGET_MAP_TYPE         0x0f            /* Mask for type of mapping */
-#endif
-
-/* Target specific */
-#if defined(TARGET_MIPS)
-#define TARGET_MAP_FIXED        0x10            /* Interpret addr exactly */
-#define TARGET_MAP_ANONYMOUS    0x0800          /* don't use a file */
-#define TARGET_MAP_GROWSDOWN    0x1000          /* stack-like segment */
-#define TARGET_MAP_DENYWRITE    0x2000          /* ETXTBSY */
-#define TARGET_MAP_EXECUTABLE   0x4000          /* mark it as an executable */
-#define TARGET_MAP_LOCKED       0x8000          /* pages are locked */
-#define TARGET_MAP_NORESERVE    0x0400          /* don't check for reservations */
-#define TARGET_MAP_POPULATE     0x10000         /* populate (prefault) pagetables */
-#define TARGET_MAP_NONBLOCK     0x20000         /* do not block on IO */
-#define TARGET_MAP_STACK        0x40000         /* ignored */
-#define TARGET_MAP_HUGETLB      0x80000         /* create a huge page mapping */
-#elif defined(TARGET_PPC)
-#define TARGET_MAP_FIXED        0x10            /* Interpret addr exactly */
-#define TARGET_MAP_ANONYMOUS    0x20            /* don't use a file */
-#define TARGET_MAP_GROWSDOWN    0x0100          /* stack-like segment */
-#define TARGET_MAP_DENYWRITE    0x0800          /* ETXTBSY */
-#define TARGET_MAP_EXECUTABLE   0x1000          /* mark it as an executable */
-#define TARGET_MAP_LOCKED       0x0080          /* pages are locked */
-#define TARGET_MAP_NORESERVE    0x0040          /* don't check for reservations */
-#define TARGET_MAP_POPULATE     0x8000          /* populate (prefault) pagetables */
-#define TARGET_MAP_NONBLOCK     0x10000         /* do not block on IO */
-#define TARGET_MAP_STACK        0x20000         /* ignored */
-#define TARGET_MAP_HUGETLB      0x40000         /* create a huge page mapping */
-#elif defined(TARGET_ALPHA)
-#define TARGET_MAP_ANONYMOUS    0x10            /* don't use a file */
-#define TARGET_MAP_FIXED        0x100           /* Interpret addr exactly */
-#define TARGET_MAP_GROWSDOWN    0x01000         /* stack-like segment */
-#define TARGET_MAP_DENYWRITE    0x02000         /* ETXTBSY */
-#define TARGET_MAP_EXECUTABLE   0x04000         /* mark it as an executable */
-#define TARGET_MAP_LOCKED       0x08000         /* lock the mapping */
-#define TARGET_MAP_NORESERVE    0x10000         /* no check for reservations */
-#define TARGET_MAP_POPULATE     0x20000         /* pop (prefault) pagetables */
-#define TARGET_MAP_NONBLOCK     0x40000         /* do not block on IO */
-#define TARGET_MAP_STACK        0x80000         /* ignored */
-#define TARGET_MAP_HUGETLB      0x100000        /* create a huge page mapping */
-#elif defined(TARGET_HPPA)
-#define TARGET_MAP_ANONYMOUS    0x10            /* don't use a file */
-#define TARGET_MAP_FIXED        0x04            /* Interpret addr exactly */
-#define TARGET_MAP_GROWSDOWN    0x08000         /* stack-like segment */
-#define TARGET_MAP_DENYWRITE    0x00800         /* ETXTBSY */
-#define TARGET_MAP_EXECUTABLE   0x01000         /* mark it as an executable */
-#define TARGET_MAP_LOCKED       0x02000         /* lock the mapping */
-#define TARGET_MAP_NORESERVE    0x04000         /* no check for reservations */
-#define TARGET_MAP_POPULATE     0x10000         /* pop (prefault) pagetables */
-#define TARGET_MAP_NONBLOCK     0x20000         /* do not block on IO */
-#define TARGET_MAP_STACK        0x40000         /* ignored */
-#define TARGET_MAP_HUGETLB      0x80000         /* create a huge page mapping */
-#elif defined(TARGET_XTENSA)
-#define TARGET_MAP_FIXED        0x10            /* Interpret addr exactly */
-#define TARGET_MAP_ANONYMOUS    0x0800          /* don't use a file */
-#define TARGET_MAP_GROWSDOWN    0x1000          /* stack-like segment */
-#define TARGET_MAP_DENYWRITE    0x2000          /* ETXTBSY */
-#define TARGET_MAP_EXECUTABLE   0x4000          /* mark it as an executable */
-#define TARGET_MAP_LOCKED       0x8000          /* pages are locked */
-#define TARGET_MAP_NORESERVE    0x0400          /* don't check for reservations */
-#define TARGET_MAP_POPULATE     0x10000         /* populate (prefault) pagetables */
-#define TARGET_MAP_NONBLOCK     0x20000         /* do not block on IO */
-#define TARGET_MAP_STACK        0x40000
-#define TARGET_MAP_HUGETLB  0x80000         /* create a huge page mapping */
-#else
-#define TARGET_MAP_FIXED        0x10            /* Interpret addr exactly */
-#define TARGET_MAP_ANONYMOUS    0x20            /* don't use a file */
-#define TARGET_MAP_GROWSDOWN    0x0100          /* stack-like segment */
-#define TARGET_MAP_DENYWRITE    0x0800          /* ETXTBSY */
-#define TARGET_MAP_EXECUTABLE   0x1000          /* mark it as an executable */
-#define TARGET_MAP_LOCKED       0x2000          /* pages are locked */
-#define TARGET_MAP_NORESERVE    0x4000          /* don't check for reservations */
-#define TARGET_MAP_POPULATE     0x8000          /* populate (prefault) pagetables */
-#define TARGET_MAP_NONBLOCK     0x10000         /* do not block on IO */
-#define TARGET_MAP_STACK        0x20000         /* ignored */
-#define TARGET_MAP_HUGETLB      0x40000         /* create a huge page mapping */
-#define TARGET_MAP_UNINITIALIZED 0x4000000      /* for anonymous mmap, memory could be uninitialized */
-#endif
+#include "target_mman.h"
 
 #if (defined(TARGET_I386) && defined(TARGET_ABI32))     \
     || (defined(TARGET_ARM) && defined(TARGET_ABI32))   \
diff --git a/linux-user/xtensa/target_mman.h b/linux-user/xtensa/target_mman.h
index e7ba6070fe..3891bb5e07 100644
--- a/linux-user/xtensa/target_mman.h
+++ b/linux-user/xtensa/target_mman.h
@@ -1 +1,17 @@
+#ifndef XTENSA_TARGET_MMAN_H
+#define XTENSA_TARGET_MMAN_H
+
+#define TARGET_MAP_NORESERVE            0x0400
+#define TARGET_MAP_ANONYMOUS            0x0800
+#define TARGET_MAP_GROWSDOWN            0x1000
+#define TARGET_MAP_DENYWRITE            0x2000
+#define TARGET_MAP_EXECUTABLE           0x4000
+#define TARGET_MAP_LOCKED               0x8000
+#define TARGET_MAP_POPULATE             0x10000
+#define TARGET_MAP_NONBLOCK             0x20000
+#define TARGET_MAP_STACK                0x40000
+#define TARGET_MAP_HUGETLB              0x80000
+
 #include "../generic/target_mman.h"
+
+#endif
-- 
2.34.1



  parent reply	other threads:[~2023-07-15 13:55 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-15 13:52 [PULL 00/47] tcg + linux-user patch queue Richard Henderson
2023-07-15 13:52 ` [PULL 01/47] linux-user: Reformat syscall_defs.h Richard Henderson
2023-07-15 13:52 ` [PULL 02/47] linux-user: Remove #if 0 block in syscall_defs.h Richard Henderson
2023-07-15 13:52 ` [PULL 03/47] linux-user: Use abi_uint not uint32_t " Richard Henderson
2023-07-15 13:52 ` [PULL 04/47] linux-user: Use abi_int not int32_t " Richard Henderson
2023-07-15 13:52 ` [PULL 05/47] linux-user: Use abi_ullong not uint64_t " Richard Henderson
2023-07-15 13:52 ` [PULL 06/47] linux-user: Use abi_llong not int64_t " Richard Henderson
2023-07-15 13:52 ` [PULL 07/47] linux-user: Use abi_uint not unsigned int " Richard Henderson
2023-07-15 13:52 ` [PULL 08/47] linux-user: Use abi_ullong not unsigned long long " Richard Henderson
2023-07-15 13:52 ` [PULL 09/47] linux-user: Use abi_llong not " Richard Henderson
2023-07-15 13:52 ` [PULL 10/47] linux-user: Use abi_int not int " Richard Henderson
2023-07-15 13:52 ` [PULL 11/47] linux-user: Use abi_ushort not unsigned short " Richard Henderson
2023-07-15 13:52 ` [PULL 12/47] linux-user: Use abi_short not " Richard Henderson
2023-07-15 13:52 ` [PULL 13/47] linux-user: Use abi_uint not unsigned " Richard Henderson
2023-07-15 13:52 ` [PULL 14/47] include/exec/user: Set ABI_LLONG_ALIGNMENT to 4 for microblaze Richard Henderson
2023-07-15 13:52 ` [PULL 15/47] include/exec/user: Set ABI_LLONG_ALIGNMENT to 4 for nios2 Richard Henderson
2023-08-08  7:19   ` Michael Tokarev
2023-07-15 13:52 ` [PULL 16/47] linux-user/syscall: Implement execve without execveat Richard Henderson
2023-07-15 13:52 ` [PULL 17/47] linux-user: Fix do_shmat type errors Richard Henderson
2023-07-15 13:52 ` [PULL 18/47] accel/tcg: Split out cpu_exec_longjmp_cleanup Richard Henderson
2023-07-15 13:52 ` [PULL 19/47] tcg: Fix info_in_idx increment in layout_arg_by_ref Richard Henderson
2023-07-15 13:52 ` [PULL 20/47] linux-user: Make sure initial brk(0) is page-aligned Richard Henderson
2023-07-16 18:15   ` Michael Tokarev
2023-07-17 14:42     ` Richard Henderson
2023-07-17 14:57       ` Michael Tokarev
2023-07-18 11:51       ` Michael Tokarev
2023-07-15 13:52 ` [PULL 21/47] linux-user: Fix formatting of mmap.c Richard Henderson
2023-07-15 13:52 ` [PULL 22/47] linux-user/strace: Expand struct flags to hold a mask Richard Henderson
2023-07-15 13:52 ` Richard Henderson [this message]
2023-07-15 13:52 ` [PULL 24/47] linux-user: Split TARGET_PROT_* out of syscall_defs.h Richard Henderson
2023-07-15 13:52 ` [PULL 25/47] linux-user: Populate more bits in mmap_flags_tbl Richard Henderson
2023-07-15 13:52 ` [PULL 26/47] accel/tcg: Introduce page_check_range_empty Richard Henderson
2023-07-15 13:52 ` [PULL 27/47] bsd-user: Use page_check_range_empty for MAP_EXCL Richard Henderson
2023-07-15 13:52 ` [PULL 28/47] linux-user: Implement MAP_FIXED_NOREPLACE Richard Henderson
2023-07-15 13:52 ` [PULL 29/47] linux-user: Split out target_to_host_prot Richard Henderson
2023-07-15 13:53 ` [PULL 30/47] linux-user: Widen target_mmap offset argument to off_t Richard Henderson
2023-07-15 13:53 ` [PULL 31/47] linux-user: Rewrite target_mprotect Richard Henderson
2023-07-15 13:53 ` [PULL 32/47] linux-user: Rewrite mmap_frag Richard Henderson
2023-07-15 13:53 ` [PULL 33/47] accel/tcg: Introduce page_find_range_empty Richard Henderson
2023-07-15 13:53 ` [PULL 34/47] bsd-user: Use page_find_range_empty for mmap_find_vma_reserved Richard Henderson
2023-07-15 13:53 ` [PULL 35/47] linux-user: " Richard Henderson
2023-07-18  9:07   ` Laurent Vivier
2023-07-15 13:53 ` [PULL 36/47] linux-user: Use 'last' instead of 'end' in target_mmap Richard Henderson
2023-07-15 13:53 ` [PULL 37/47] linux-user: Rewrite mmap_reserve Richard Henderson
2023-07-15 13:53 ` [PULL 38/47] linux-user: Rename mmap_reserve to mmap_reserve_or_unmap Richard Henderson
2023-09-18  8:35   ` Andreas Schwab
2023-10-03 21:03     ` Richard Henderson
2023-07-15 13:53 ` [PULL 39/47] linux-user: Simplify target_munmap Richard Henderson
2023-07-15 13:53 ` [PULL 40/47] accel/tcg: Accept more page flags in page_check_range Richard Henderson
2023-07-15 13:53 ` [PULL 41/47] accel/tcg: Return bool from page_check_range Richard Henderson
2023-07-15 13:53 ` [PULL 42/47] linux-user: Remove can_passthrough_madvise Richard Henderson
2023-07-15 13:53 ` [PULL 43/47] linux-user: Simplify target_madvise Richard Henderson
2023-07-15 13:53 ` [PULL 44/47] linux-user: Drop uint and ulong Richard Henderson
2023-07-15 13:53 ` [PULL 45/47] linux-user/arm: Do not allocate a commpage at all for M-profile CPUs Richard Henderson
2023-07-16 18:13   ` Michael Tokarev
2023-07-17 14:42     ` Richard Henderson
2023-07-15 13:53 ` [PULL 46/47] accel/tcg: Always lock pages before translation Richard Henderson
2023-07-15 13:53 ` [PULL 47/47] tcg: Use HAVE_CMPXCHG128 instead of CONFIG_CMPXCHG128 Richard Henderson
2023-07-16 16:49 ` [PULL 00/47] tcg + linux-user patch queue Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230715135317.7219-24-richard.henderson@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).