mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
semihosting: Create semihost_sys_poll_one
This will be used for implementing the xtensa select_one system call. Choose "poll" over "select" so that we can reuse Glib's g_poll constants and to avoid struct timeval. Reviewed-by: Luc Michel <lmichel@kalray.eu> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
2d010c2719
commit
1b9177f749
4 changed files with 106 additions and 2 deletions
|
@ -77,10 +77,17 @@ static void console_read(void *opaque, const uint8_t *buf, int size)
|
|||
c->sleeping_cpus = NULL;
|
||||
}
|
||||
|
||||
int qemu_semihosting_console_read(CPUState *cs, void *buf, int len)
|
||||
bool qemu_semihosting_console_ready(void)
|
||||
{
|
||||
SemihostingConsole *c = &console;
|
||||
|
||||
g_assert(qemu_mutex_iothread_locked());
|
||||
return !fifo8_is_empty(&c->fifo);
|
||||
}
|
||||
|
||||
void qemu_semihosting_console_block_until_ready(CPUState *cs)
|
||||
{
|
||||
SemihostingConsole *c = &console;
|
||||
int ret = 0;
|
||||
|
||||
g_assert(qemu_mutex_iothread_locked());
|
||||
|
||||
|
@ -92,6 +99,14 @@ int qemu_semihosting_console_read(CPUState *cs, void *buf, int len)
|
|||
cpu_loop_exit(cs);
|
||||
/* never returns */
|
||||
}
|
||||
}
|
||||
|
||||
int qemu_semihosting_console_read(CPUState *cs, void *buf, int len)
|
||||
{
|
||||
SemihostingConsole *c = &console;
|
||||
int ret = 0;
|
||||
|
||||
qemu_semihosting_console_block_until_ready(cs);
|
||||
|
||||
/* Read until buffer full or fifo exhausted. */
|
||||
do {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue