@@ -7767,7 +7767,17 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
case TARGET_NR_write:
if (!(p = lock_user(VERIFY_READ, arg2, arg3, 1)))
goto efault;
- ret = get_errno(safe_write(arg1, p, arg3));
+ 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));
+ }
unlock_user(p, arg2, 0);
break;
#ifdef TARGET_NR_open