target/xtensa: support output to chardev console
PATCH v2 1/1 target/xtensa: support output to chardev console
In semihosting mode QEMU allows guest to read and write host file descriptors directly, including descriptors 0..2, a.k.a. stdin, stdout and stderr. Sometimes it's desirable to have semihosting console controlled by -serial option, e.g. to connect it to network.
Add semihosting console to xtensa-semi.c, open it in the 'sim' machine in the presence of -serial option and direct stdout and stderr to it when it's present.
Signed-off-by Max Filippov <[email protected]>
---
Changes v1->v2:
- include chardev/char-fe.h instead of sysemu/char.h
hw/xtensa/sim.c | 4 +++ target/xtensa/cpu.h | 1 + target/xtensa/xtensa-semi.c | 66 +++++++++++++++++++++++++++++++++++---------- 3 files changed, 57 insertions(+), 14 deletions(-)
hw/xtensa/sim.c +4 -0
@@ -114,6 +114,9 @@ static void xtensa_sim_init(MachineState *machine)xtensa_create_memory_regions (&sysram,"xtensa.sysram" ); } +if (serial_hds[0 ]) { +xtensa_sim_open_console (serial_hds[0 ]); + }if (kernel_filename) {uint64_t elf_entry;uint64_t elf_lowaddr;
@@ -136,6 +139,7 @@ static void xtensa_sim_machine_init(MachineClass *mc) mc->is_default = true; mc->init = xtensa_sim_init; mc->max_cpus =4 ; + mc->no_serial =1 ; }DEFINE_MACHINE ("sim" , xtensa_sim_machine_init)
target/xtensa/cpu.h +1 -0
@@ -483,6 +483,7 @@ void xtensa_translate_init(void);void xtensa_breakpoint_handler (CPUState *cs);void xtensa_finalize_config (XtensaConfig *config);void xtensa_register_core (XtensaConfigList *node); +void xtensa_sim_open_console (Chardev *chr);void check_interrupts (CPUXtensaState *s);void xtensa_irq_init (CPUXtensaState *env);void *xtensa_get_extint (CPUXtensaState *env,unsigned extint);
target/xtensa/xtensa-semi.c +52 -14
99 lines not on this page · raw message
Signature · 1 line
2.1.4