aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Musta <tommusta@gmail.com>2014-08-12 13:53:42 -0500
committerRiku Voipio <riku.voipio@linaro.org>2014-08-22 15:06:35 +0300
commit6f6a40328b6f4679082583c2b3a949cda451a991 (patch)
tree90c90e80f2bfa3a2bade02ffbdd97a667940fbd3
parent8fbe8fdfbc7576c58c59b605354457cc02076304 (diff)
downloadqemu-arm-6f6a40328b6f4679082583c2b3a949cda451a991.tar.gz
linux-user: Support target-to-host translation of mlockall argument
The argument to the mlockall system call is not necessarily the same on all platforms and thus may require translation prior to passing to the host. For example, PowerPC 64 bit platforms define values for MCL_CURRENT (0x2000) and MCL_FUTURE (0x4000) which are different from Intel platforms (0x1 and 0x2, respectively) Signed-off-by: Tom Musta <tommusta@gmail.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
-rw-r--r--linux-user/aarch64/syscall.h2
-rw-r--r--linux-user/alpha/syscall.h2
-rw-r--r--linux-user/arm/syscall.h2
-rw-r--r--linux-user/cris/syscall.h2
-rw-r--r--linux-user/i386/syscall.h2
-rw-r--r--linux-user/m68k/syscall.h2
-rw-r--r--linux-user/microblaze/syscall.h2
-rw-r--r--linux-user/mips/syscall.h2
-rw-r--r--linux-user/mips64/syscall.h2
-rw-r--r--linux-user/openrisc/syscall.h2
-rw-r--r--linux-user/ppc/syscall.h2
-rw-r--r--linux-user/s390x/syscall.h2
-rw-r--r--linux-user/sh4/syscall.h2
-rw-r--r--linux-user/sparc/syscall.h2
-rw-r--r--linux-user/sparc64/syscall.h2
-rw-r--r--linux-user/syscall.c17
-rw-r--r--linux-user/unicore32/syscall.h2
-rw-r--r--linux-user/x86_64/syscall.h2
18 files changed, 50 insertions, 1 deletions
diff --git a/linux-user/aarch64/syscall.h b/linux-user/aarch64/syscall.h
index d1f48232f3..dc72a15c5e 100644
--- a/linux-user/aarch64/syscall.h
+++ b/linux-user/aarch64/syscall.h
@@ -9,3 +9,5 @@ struct target_pt_regs {
#define UNAME_MINIMUM_RELEASE "3.8.0"
#define TARGET_CLONE_BACKWARDS
#define TARGET_MINSIGSTKSZ 2048
+#define TARGET_MLOCKALL_MCL_CURRENT 1
+#define TARGET_MLOCKALL_MCL_FUTURE 2
diff --git a/linux-user/alpha/syscall.h b/linux-user/alpha/syscall.h
index 3adedeba30..245cff2545 100644
--- a/linux-user/alpha/syscall.h
+++ b/linux-user/alpha/syscall.h
@@ -253,3 +253,5 @@ struct target_pt_regs {
#define TARGET_UAC_NOFIX 2
#define TARGET_UAC_SIGBUS 4
#define TARGET_MINSIGSTKSZ 4096
+#define TARGET_MLOCKALL_MCL_CURRENT 0x2000
+#define TARGET_MLOCKALL_MCL_FUTURE 0x4000
diff --git a/linux-user/arm/syscall.h b/linux-user/arm/syscall.h
index cdadb0ce82..3844a96112 100644
--- a/linux-user/arm/syscall.h
+++ b/linux-user/arm/syscall.h
@@ -46,3 +46,5 @@ struct target_pt_regs {
#define TARGET_CLONE_BACKWARDS
#define TARGET_MINSIGSTKSZ 2048
+#define TARGET_MLOCKALL_MCL_CURRENT 1
+#define TARGET_MLOCKALL_MCL_FUTURE 2
diff --git a/linux-user/cris/syscall.h b/linux-user/cris/syscall.h
index a75bcc49ea..2957b0d6ae 100644
--- a/linux-user/cris/syscall.h
+++ b/linux-user/cris/syscall.h
@@ -40,5 +40,7 @@ struct target_pt_regs {
#define TARGET_CLONE_BACKWARDS2
#define TARGET_MINSIGSTKSZ 2048
+#define TARGET_MLOCKALL_MCL_CURRENT 1
+#define TARGET_MLOCKALL_MCL_FUTURE 2
#endif
diff --git a/linux-user/i386/syscall.h b/linux-user/i386/syscall.h
index acf685622d..906aaac0b1 100644
--- a/linux-user/i386/syscall.h
+++ b/linux-user/i386/syscall.h
@@ -148,3 +148,5 @@ struct target_vm86plus_struct {
#define TARGET_CLONE_BACKWARDS
#define TARGET_MINSIGSTKSZ 2048
+#define TARGET_MLOCKALL_MCL_CURRENT 1
+#define TARGET_MLOCKALL_MCL_FUTURE 2
diff --git a/linux-user/m68k/syscall.h b/linux-user/m68k/syscall.h
index f8553f8c11..9218493a44 100644
--- a/linux-user/m68k/syscall.h
+++ b/linux-user/m68k/syscall.h
@@ -19,5 +19,7 @@ struct target_pt_regs {
#define UNAME_MINIMUM_RELEASE "2.6.32"
#define TARGET_MINSIGSTKSZ 2048
+#define TARGET_MLOCKALL_MCL_CURRENT 1
+#define TARGET_MLOCKALL_MCL_FUTURE 2
void do_m68k_simcall(CPUM68KState *, int);
diff --git a/linux-user/microblaze/syscall.h b/linux-user/microblaze/syscall.h
index 2a5e160b03..3c1ed27c04 100644
--- a/linux-user/microblaze/syscall.h
+++ b/linux-user/microblaze/syscall.h
@@ -50,5 +50,7 @@ struct target_pt_regs {
#define TARGET_CLONE_BACKWARDS
#define TARGET_MINSIGSTKSZ 2048
+#define TARGET_MLOCKALL_MCL_CURRENT 1
+#define TARGET_MLOCKALL_MCL_FUTURE 2
#endif
diff --git a/linux-user/mips/syscall.h b/linux-user/mips/syscall.h
index 0b4662c1d7..35ca23b166 100644
--- a/linux-user/mips/syscall.h
+++ b/linux-user/mips/syscall.h
@@ -229,3 +229,5 @@ struct target_pt_regs {
#define TARGET_CLONE_BACKWARDS
#define TARGET_MINSIGSTKSZ 2048
+#define TARGET_MLOCKALL_MCL_CURRENT 1
+#define TARGET_MLOCKALL_MCL_FUTURE 2
diff --git a/linux-user/mips64/syscall.h b/linux-user/mips64/syscall.h
index 39b8bedf05..6733107ddb 100644
--- a/linux-user/mips64/syscall.h
+++ b/linux-user/mips64/syscall.h
@@ -226,3 +226,5 @@ struct target_pt_regs {
#define TARGET_CLONE_BACKWARDS
#define TARGET_MINSIGSTKSZ 2048
+#define TARGET_MLOCKALL_MCL_CURRENT 1
+#define TARGET_MLOCKALL_MCL_FUTURE 2
diff --git a/linux-user/openrisc/syscall.h b/linux-user/openrisc/syscall.h
index e5e618099f..8ac03656d4 100644
--- a/linux-user/openrisc/syscall.h
+++ b/linux-user/openrisc/syscall.h
@@ -25,3 +25,5 @@ struct target_pt_regs {
#define UNAME_MINIMUM_RELEASE "2.6.32"
#define TARGET_MINSIGSTKSZ 2048
+#define TARGET_MLOCKALL_MCL_CURRENT 1
+#define TARGET_MLOCKALL_MCL_FUTURE 2
diff --git a/linux-user/ppc/syscall.h b/linux-user/ppc/syscall.h
index 5311cc6987..0daf5cd2df 100644
--- a/linux-user/ppc/syscall.h
+++ b/linux-user/ppc/syscall.h
@@ -71,3 +71,5 @@ struct target_revectored_struct {
#define TARGET_CLONE_BACKWARDS
#define TARGET_MINSIGSTKSZ 2048
+#define TARGET_MLOCKALL_MCL_CURRENT 0x2000
+#define TARGET_MLOCKALL_MCL_FUTURE 0x4000
diff --git a/linux-user/s390x/syscall.h b/linux-user/s390x/syscall.h
index b11a3b2690..35f170af25 100644
--- a/linux-user/s390x/syscall.h
+++ b/linux-user/s390x/syscall.h
@@ -25,3 +25,5 @@ struct target_pt_regs {
#define TARGET_CLONE_BACKWARDS2
#define TARGET_MINSIGSTKSZ 2048
+#define TARGET_MLOCKALL_MCL_CURRENT 1
+#define TARGET_MLOCKALL_MCL_FUTURE 2
diff --git a/linux-user/sh4/syscall.h b/linux-user/sh4/syscall.h
index 285ecf3a79..7aa4f239c5 100644
--- a/linux-user/sh4/syscall.h
+++ b/linux-user/sh4/syscall.h
@@ -13,3 +13,5 @@ struct target_pt_regs {
#define UNAME_MINIMUM_RELEASE "2.6.32"
#define TARGET_MINSIGSTKSZ 2048
+#define TARGET_MLOCKALL_MCL_CURRENT 1
+#define TARGET_MLOCKALL_MCL_FUTURE 2
diff --git a/linux-user/sparc/syscall.h b/linux-user/sparc/syscall.h
index ae4074414f..58573b92ea 100644
--- a/linux-user/sparc/syscall.h
+++ b/linux-user/sparc/syscall.h
@@ -16,3 +16,5 @@ struct target_pt_regs {
*/
#define TARGET_CLONE_BACKWARDS
#define TARGET_MINSIGSTKSZ 4096
+#define TARGET_MLOCKALL_MCL_CURRENT 0x2000
+#define TARGET_MLOCKALL_MCL_FUTURE 0x4000
diff --git a/linux-user/sparc64/syscall.h b/linux-user/sparc64/syscall.h
index 816a00f568..8398d3f463 100644
--- a/linux-user/sparc64/syscall.h
+++ b/linux-user/sparc64/syscall.h
@@ -17,3 +17,5 @@ struct target_pt_regs {
*/
#define TARGET_CLONE_BACKWARDS
#define TARGET_MINSIGSTKSZ 4096
+#define TARGET_MLOCKALL_MCL_CURRENT 0x2000
+#define TARGET_MLOCKALL_MCL_FUTURE 0x4000
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 450f22dcc1..1da216e2fb 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4968,6 +4968,21 @@ static inline abi_long target_to_host_sigevent(struct sigevent *host_sevp,
return 0;
}
+#if defined(TARGET_NR_mlockall)
+static inline int target_to_host_mlockall_arg(int arg)
+{
+ int result = 0;
+
+ if (arg & TARGET_MLOCKALL_MCL_CURRENT) {
+ result |= MCL_CURRENT;
+ }
+ if (arg & TARGET_MLOCKALL_MCL_FUTURE) {
+ result |= MCL_FUTURE;
+ }
+ return result;
+}
+#endif
+
#if defined(TARGET_NR_stat64) || defined(TARGET_NR_newfstatat)
static inline abi_long host_to_target_stat64(void *cpu_env,
abi_ulong target_addr,
@@ -6820,7 +6835,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
#endif
#ifdef TARGET_NR_mlockall
case TARGET_NR_mlockall:
- ret = get_errno(mlockall(arg1));
+ ret = get_errno(mlockall(target_to_host_mlockall_arg(arg1)));
break;
#endif
#ifdef TARGET_NR_munlockall
diff --git a/linux-user/unicore32/syscall.h b/linux-user/unicore32/syscall.h
index 3ed623721a..385a97562d 100644
--- a/linux-user/unicore32/syscall.h
+++ b/linux-user/unicore32/syscall.h
@@ -54,5 +54,7 @@ struct target_pt_regs {
#define UNAME_MINIMUM_RELEASE "2.6.32"
#define TARGET_MINSIGSTKSZ 2048
+#define TARGET_MLOCKALL_MCL_CURRENT 1
+#define TARGET_MLOCKALL_MCL_FUTURE 2
#endif /* __UC32_SYSCALL_H__ */
diff --git a/linux-user/x86_64/syscall.h b/linux-user/x86_64/syscall.h
index 5828b91026..88b3c3fe31 100644
--- a/linux-user/x86_64/syscall.h
+++ b/linux-user/x86_64/syscall.h
@@ -98,3 +98,5 @@ struct target_msqid64_ds {
#define TARGET_ARCH_GET_FS 0x1003
#define TARGET_ARCH_GET_GS 0x1004
#define TARGET_MINSIGSTKSZ 2048
+#define TARGET_MLOCKALL_MCL_CURRENT 1
+#define TARGET_MLOCKALL_MCL_FUTURE 2