semihosting: Expand qemu_semihosting_console_inc to read

Allow more than one character to be read at one time.
Will be used by m68k and nios2 semihosting for stdio.

Reviewed-by: Luc Michel <lmichel@kalray.eu>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2022-05-01 12:31:08 -07:00
parent 3367d452b0
commit e7fb6f3205
4 changed files with 34 additions and 15 deletions

View file

@ -38,19 +38,21 @@ int qemu_semihosting_console_outs(CPUArchState *env, target_ulong s);
void qemu_semihosting_console_outc(CPUArchState *env, target_ulong c);
/**
* qemu_semihosting_console_inc:
* qemu_semihosting_console_read:
* @cs: CPUState
* @buf: host buffer
* @len: buffer size
*
* Receive single character from debug console. As this call may block
* if no data is available we suspend the CPU and will re-execute the
* Receive at least one character from debug console. As this call may
* block if no data is available we suspend the CPU and will re-execute the
* instruction when data is there. Therefore two conditions must be met:
*
* - CPUState is synchronized before calling this function
* - pc is only updated once the character is successfully returned
*
* Returns: character read OR cpu_loop_exit!
* Returns: number of characters read, OR cpu_loop_exit!
*/
target_ulong qemu_semihosting_console_inc(CPUState *cs);
int qemu_semihosting_console_read(CPUState *cs, void *buf, int len);
/**
* qemu_semihosting_log_out: