mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-09-09 08:17:53 -06:00
linux-user: call fd_trans_target_to_host_data() for write()
As for sendmsg() or sendto(), we must call the target to host data translator if it is defined. This is needed for eventfd(): the write() syscall allows to add a value to the internal counter, and so, it must be byte-swapped to the host order. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
This commit is contained in:
parent
9964e96dc9
commit
04b9bcf911
1 changed files with 11 additions and 1 deletions
|
@ -7767,7 +7767,17 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
|
||||||
case TARGET_NR_write:
|
case TARGET_NR_write:
|
||||||
if (!(p = lock_user(VERIFY_READ, arg2, arg3, 1)))
|
if (!(p = lock_user(VERIFY_READ, arg2, arg3, 1)))
|
||||||
goto efault;
|
goto efault;
|
||||||
|
if (fd_trans_target_to_host_data(arg1)) {
|
||||||
|
void *copy = g_malloc(arg3);
|
||||||
|
memcpy(copy, p, arg3);
|
||||||
|
ret = fd_trans_target_to_host_data(arg1)(copy, arg3);
|
||||||
|
if (ret >= 0) {
|
||||||
|
ret = get_errno(safe_write(arg1, copy, ret));
|
||||||
|
}
|
||||||
|
g_free(copy);
|
||||||
|
} else {
|
||||||
ret = get_errno(safe_write(arg1, p, arg3));
|
ret = get_errno(safe_write(arg1, p, arg3));
|
||||||
|
}
|
||||||
unlock_user(p, arg2, 0);
|
unlock_user(p, arg2, 0);
|
||||||
break;
|
break;
|
||||||
#ifdef TARGET_NR_open
|
#ifdef TARGET_NR_open
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue