semihosting: Create qemu_semihosting_guestfd_init

For arm-compat, initialize console_{in,out}_gf;
otherwise, initialize stdio file descriptors.

This will go some way to cleaning up arm-compat, and
will allow other semihosting to use normal stdio.

Reviewed-by: Luc Michel <lmichel@kalray.eu>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2022-05-01 17:21:00 -07:00
parent 008e147572
commit e4a4aaa51b
5 changed files with 61 additions and 10 deletions

View file

@ -54,6 +54,10 @@
#include "loader.h"
#include "user-mmap.h"
#ifdef CONFIG_SEMIHOSTING
#include "semihosting/semihost.h"
#endif
#ifndef AT_FLAGS_PRESERVE_ARGV0
#define AT_FLAGS_PRESERVE_ARGV0_BIT 0
#define AT_FLAGS_PRESERVE_ARGV0 (1 << AT_FLAGS_PRESERVE_ARGV0_BIT)
@ -906,6 +910,11 @@ int main(int argc, char **argv, char **envp)
}
gdb_handlesig(cpu, 0);
}
#ifdef CONFIG_SEMIHOSTING
qemu_semihosting_guestfd_init();
#endif
cpu_loop(env);
/* never exits */
return 0;