diff options
author | Max Filippov <jcmvbkbc@gmail.com> | 2017-05-12 11:09:14 -0700 |
---|---|---|
committer | Max Filippov <jcmvbkbc@gmail.com> | 2017-06-06 02:40:48 -0700 |
commit | 8128b3e0798e6c7e5742fa9f85bf8a4bf90af94a (patch) | |
tree | 068e7f48cbe3422f7ff79a6ee339657bb6221f4f /hw/xtensa | |
parent | 347ec03093f9668a379ef6b7fa1feb332fff039c (diff) |
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 <jcmvbkbc@gmail.com>
Diffstat (limited to 'hw/xtensa')
-rw-r--r-- | hw/xtensa/sim.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/xtensa/sim.c b/hw/xtensa/sim.c index b27e28d802..5521e9184a 100644 --- a/hw/xtensa/sim.c +++ b/hw/xtensa/sim.c @@ -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) |