]> Git Repo - qemu.git/commitdiff
linux-user: Support target-to-host translation of mlockall argument
authorTom Musta <[email protected]>
Tue, 12 Aug 2014 18:53:42 +0000 (13:53 -0500)
committerRiku Voipio <[email protected]>
Fri, 22 Aug 2014 12:06:35 +0000 (15:06 +0300)
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 <[email protected]>
Signed-off-by: Riku Voipio <[email protected]>
18 files changed:
linux-user/aarch64/syscall.h
linux-user/alpha/syscall.h
linux-user/arm/syscall.h
linux-user/cris/syscall.h
linux-user/i386/syscall.h
linux-user/m68k/syscall.h
linux-user/microblaze/syscall.h
linux-user/mips/syscall.h
linux-user/mips64/syscall.h
linux-user/openrisc/syscall.h
linux-user/ppc/syscall.h
linux-user/s390x/syscall.h
linux-user/sh4/syscall.h
linux-user/sparc/syscall.h
linux-user/sparc64/syscall.h
linux-user/syscall.c
linux-user/unicore32/syscall.h
linux-user/x86_64/syscall.h

index d1f48232f38439276c694d503bc002ae030eca3a..dc72a15c5e2ae55267c64bbb549abb579adcbc39 100644 (file)
@@ -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
index 3adedeba3099742532eced3534e883632fbd6973..245cff2545bceb3d66df1a14c5939391a1aa8415 100644 (file)
@@ -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
index cdadb0ce82c65fee4646d6f3d91574ef334489cd..3844a961121e3f086923864277062d3f114ebbec 100644 (file)
@@ -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
index a75bcc49ea756bc0a86027e7de406db263b24939..2957b0d6ae61feaa52136afbc2845de6e3d1c5f4 100644 (file)
@@ -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
index acf685622d1c6dfb008e6509c6c6066d685951f0..906aaac0b1c6941dd4e329c525b7eb0220228dd9 100644 (file)
@@ -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
index f8553f8c11aff21a18fab43415610355b58e5766..9218493a44ba375c27d6f23b135bf8fdc9e86009 100644 (file)
@@ -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);
index 2a5e160b0304e4931ad6b0d57c39551665c6442b..3c1ed27c04a33e15e83bfe23945e40e86b7fe682 100644 (file)
@@ -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
index 0b4662c1d70dfd81eccf2aabac44128c6efdac99..35ca23b1661c2d41954b921c73fab208a45c019f 100644 (file)
@@ -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
index 39b8bedf05acbbfd7130376a89e912f5d84818f4..6733107ddbf5fa209c466c86a7a50d765c8e79f2 100644 (file)
@@ -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
index e5e618099f83150dd76caabc7c25258d398e3f6f..8ac03656d4b1a1fc115811f8a2435978e1f39b49 100644 (file)
@@ -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
index 5311cc6987b1c920f0f544976a8e8a4977c8c421..0daf5cd2df0dfc34e76954680fb16cdb73d095c2 100644 (file)
@@ -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
index b11a3b2690451a6adcb2af162403da0de4618900..35f170af252846fc2c0b0fbe0844133a0ab3b703 100644 (file)
@@ -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
index 285ecf3a79fc3162644d3dd55aff161976bd15db..7aa4f239c51e74547215a44a9e236a2855637688 100644 (file)
@@ -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
index ae4074414f1d9bf84ea8b9ca7779787caa1f4a1b..58573b92ea635df4d7634193169b650d34a8f42f 100644 (file)
@@ -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
index 816a00f568242a68b73b4e8be9dafe2e1b8d0dde..8398d3f4636cad92b1764a0a242bb6ba8cdaee0f 100644 (file)
@@ -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
index 450f22dcc10ae94c8f1b0ff096f37e010125528a..1da216e2fb4a06d4af387a67f199e23e50452614 100644 (file)
@@ -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
index 3ed623721afbf2f749464e361b7c0e2878f39814..385a97562dc2b2c9e426e3a022152269f57c7a72 100644 (file)
@@ -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__ */
index 5828b91026f0d4712d3aeab99b13c4305d715d15..88b3c3fe3165f24e37aca2845823eb1c6c88bd76 100644 (file)
@@ -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
This page took 0.042007 seconds and 4 git commands to generate.