mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
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>
This commit is contained in:
parent
8fbe8fdfbc
commit
6f6a40328b
18 changed files with 50 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue