From cd66f20f614bb492e4e5be11e4b65d58b4a046ca Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Sun, 1 May 2022 12:42:37 -0700 Subject: semihosting: Create qemu_semihosting_console_write Will replace qemu_semihosting_console_{outs,outc}, but we need more plumbing first. Reviewed-by: Luc Michel Signed-off-by: Richard Henderson --- semihosting/console.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'semihosting') diff --git a/semihosting/console.c b/semihosting/console.c index 1d16a290c4..540aa0cd4b 100644 --- a/semihosting/console.c +++ b/semihosting/console.c @@ -169,6 +169,15 @@ int qemu_semihosting_console_read(CPUState *cs, void *buf, int len) return ret; } +int qemu_semihosting_console_write(void *buf, int len) +{ + if (console.chr) { + return qemu_chr_write_all(console.chr, (uint8_t *)buf, len); + } else { + return fwrite(buf, 1, len, stderr); + } +} + void qemu_semihosting_console_init(Chardev *chr) { console.chr = chr; -- cgit v1.2.3