]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
semihosting: Don't copy buffer after console_write()
authorPeter Maydell <peter.maydell@linaro.org>
Mon, 25 Jul 2022 14:05:14 +0000 (15:05 +0100)
committerAlex Bennée <alex.bennee@linaro.org>
Fri, 29 Jul 2022 08:48:01 +0000 (09:48 +0100)
The console_write() semihosting function outputs guest data from a
buffer; it doesn't update that buffer.  It therefore doesn't need to
pass a length value to unlock_user(), but can pass 0, meaning "do not
copy any data back to the guest memory".

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220719121110.225657-3-peter.maydell@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220725140520.515340-8-alex.bennee@linaro.org>

semihosting/syscalls.c

index 4847f66c023016f215075d72f2b35fd41e86b123..508a0ad88c68bfaa6cdc1479e32a213525b4e552 100644 (file)
@@ -627,7 +627,7 @@ static void console_write(CPUState *cs, gdb_syscall_complete_cb complete,
     }
     ret = qemu_semihosting_console_write(ptr, len);
     complete(cs, ret ? ret : -1, ret ? 0 : EIO);
-    unlock_user(ptr, buf, ret);
+    unlock_user(ptr, buf, 0);
 }
 
 static void console_fstat(CPUState *cs, gdb_syscall_complete_cb complete,