mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-29 05:13:54 -06:00
semihosting: Create qemu_semihosting_console_write
Will replace qemu_semihosting_console_{outs,outc}, but we need more plumbing first. Reviewed-by: Luc Michel <lmichel@kalray.eu> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
fb08790b35
commit
cd66f20f61
3 changed files with 26 additions and 0 deletions
|
@ -54,6 +54,18 @@ void qemu_semihosting_console_outc(CPUArchState *env, target_ulong c);
|
||||||
*/
|
*/
|
||||||
int qemu_semihosting_console_read(CPUState *cs, void *buf, int len);
|
int qemu_semihosting_console_read(CPUState *cs, void *buf, int len);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* qemu_semihosting_console_write:
|
||||||
|
* @buf: host buffer
|
||||||
|
* @len: buffer size
|
||||||
|
*
|
||||||
|
* Write len bytes from buf to the debug console.
|
||||||
|
*
|
||||||
|
* Returns: number of bytes written -- this should only ever be short
|
||||||
|
* on some sort of i/o error.
|
||||||
|
*/
|
||||||
|
int qemu_semihosting_console_write(void *buf, int len);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* qemu_semihosting_log_out:
|
* qemu_semihosting_log_out:
|
||||||
* @s: pointer to string
|
* @s: pointer to string
|
||||||
|
|
|
@ -76,3 +76,8 @@ int qemu_semihosting_console_read(CPUState *cs, void *buf, int len)
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int qemu_semihosting_console_write(void *buf, int len)
|
||||||
|
{
|
||||||
|
return fwrite(buf, 1, len, stderr);
|
||||||
|
}
|
||||||
|
|
|
@ -169,6 +169,15 @@ int qemu_semihosting_console_read(CPUState *cs, void *buf, int len)
|
||||||
return ret;
|
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)
|
void qemu_semihosting_console_init(Chardev *chr)
|
||||||
{
|
{
|
||||||
console.chr = chr;
|
console.chr = chr;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue