On 24/1/23 19:01, Alex Bennée wrote:
From: Keith Packard <kei...@keithp.com>

'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 <kei...@keithp.com>
Reviewed-by: Richard Henderson <richard.hender...@linaro.org>
Message-Id: <20221012014822.1242170-1-kei...@keithp.com>
Signed-off-by: Alex Bennée <alex.ben...@linaro.org>
---
  semihosting/syscalls.c | 20 ++++++++++----------
  1 file changed, 10 insertions(+), 10 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <phi...@linaro.org>


Reply via email to