]> git.proxmox.com Git - mirror_qemu.git/commit
semihosting: Write back semihosting data before completion callback
authorKeith Packard <keithp@keithp.com>
Tue, 24 Jan 2023 18:01:15 +0000 (18:01 +0000)
committerAlex Bennée <alex.bennee@linaro.org>
Thu, 2 Feb 2023 11:48:20 +0000 (11:48 +0000)
commit978c2bf97b2f8b0938dc6570c46275ed8d8e96f8
tree9506de96b216942c811c9fcd2d6a1e28dc49ee22
parent2c46bc240a1ac9b99974fcd4b735a6715ce99798
semihosting: Write back semihosting data before completion callback

'lock_user' allocates a host buffer to shadow a target buffer,
'unlock_user' copies that host buffer back to the target and frees the
host memory. If the completion function uses the target buffer, it
must be called after unlock_user to ensure the data are present.

This caused the arm-compatible TARGET_SYS_READC to fail as the
completion function, common_semi_readc_cb, pulled data from the target
buffer which would not have been gotten the console data.

I decided to fix all instances of this pattern instead of just the
console_read function to make things consistent and potentially fix
bugs in other cases.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20221012014822.1242170-1-keithp@keithp.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230124180127.1881110-24-alex.bennee@linaro.org>
semihosting/syscalls.c