semihosting: defer connect_chardevs a little more to use serialx
PATCH 1/2 semihosting: defer connect_chardevs a little more to use serialx
From: KONRAD Frederic <[email protected]>
With that we can just use chardev=serial0.
--- softmmu/vl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
softmmu/vl.c +3 -2
@@ -4123,8 +4123,6 @@ void qemu_init(int argc, char **argv, char **envp)qemu_opts_foreach (qemu_find_opts ("chardev" ), chardev_init_func,NULL , &error_fatal); -/* now chardevs have been created we may have semihosting to connect */ -qemu_semihosting_connect_chardevs ();#ifdef CONFIG_VIRTFS qemu_opts_foreach(qemu_find_opts("fsdev"),
@@ -4271,6 +4269,9 @@ void qemu_init(int argc, char **argv, char **envp)if (foreach_device_config (DEV_DEBUGCON , debugcon_parse) <0 )exit (1 ); +/* now chardevs have been created we may have semihosting to connect */ +qemu_semihosting_connect_chardevs (); +/* If no default VGA is requested, the default is "none". */ if (default_vga) { vga_model =get_default_vga_model (machine_class);
Signature · 1 line
1.8.3.1
PATCH 2/2 semihosting: don't send the trailing '\0'
From: KONRAD Frederic <[email protected]>
Don't send the trailing 0 from the string.
--- hw/semihosting/console.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
hw/semihosting/console.c +3 -1
@@ -52,7 +52,9 @@ static GString *copy_user_string(CPUArchState *env, target_ulong addr) do { if (cpu_memory_rw_debug(cpu, addr++, &c, 1, 0) == 0) { - s = g_string_append_c(s, c); + if (c) { + s = g_string_append_c(s, c); + } } else { qemu_log_mask(LOG_GUEST_ERROR, "%s: passed inaccessible address " TARGET_FMT_lx,
Signature · 1 line
1.8.3.1
Re: [PATCH v1 2/2] semihosting: don't send the trailing '\0'
Quoted 4 lines · On 6/15/20 12:00 PM, [email protected] wrote:
From: KONRAD Frederic <[email protected]>
Don't send the trailing 0 from the string.
Quoted 21 lines
Signed-off-by KONRAD Frederic <[email protected]>--- hw/semihosting/console.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)hw/semihosting/console.c +3
-1@@ -52,7 +52,9 @@ static GString *copy_user_string(CPUArchState *env, target_ulong addr) do { if (cpu_memory_rw_debug(cpu, addr++, &c, 1, 0) == 0) { - s = g_string_append_c(s, c); + if (c) { + s = g_string_append_c(s, c); + } } else { qemu_log_mask(LOG_GUEST_ERROR, "%s: passed inaccessible address " TARGET_FMT_lx,
Re: [PATCH v1 2/2] semihosting: don't send the trailing '\0'
In reply to [email protected]Quoted 5 lines · [email protected] writes:
From: KONRAD Frederic <[email protected]>
Don't send the trailing 0 from the string.
Signed-off-by KONRAD Frederic <[email protected]>
Signature · 1 line
Alex Bennée
Quoted 3 lines · [email protected] writes:
From: KONRAD Frederic <[email protected]>
With that we can just use chardev=serial0.
I don't quite follow what this means.
./aarch64-softmmu/qemu-system-aarch64 -cpu max -monitor none -chardev=serial0 -M virt -display none -semihosting -kernel ./tests/tcg/aarch64-softmmu/memory
qemu-system-aarch64: -chardev=serial0: invalid option
./aarch64-softmmu/qemu-system-aarch64 -cpu max -monitor none -chardev id=serial0 -M virt -display none -semihosting -kernel ./tests/tcg/aarch64-softmmu/memory
qemu-system-aarch64: -chardev id=serial0: chardev: "serial0" missing backend
The run:
./aarch64-softmmu/qemu-system-aarch64 -cpu max -serial mon:stdio -M virt -display none -semihosting -kernel ./tests/tcg/aarch64-softmmu/memory
works fine without this patch.
Quoted 29 lines
Signed-off-by KONRAD Frederic <[email protected]>--- softmmu/vl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)softmmu/vl.c +3
-2@@ -4123,8 +4123,6 @@ void qemu_init(int argc, char **argv, char **envp)qemu_opts_foreach (qemu_find_opts ("chardev" ), chardev_init_func,NULL , &error_fatal); -/* now chardevs have been created we may have semihosting to connect */ -qemu_semihosting_connect_chardevs ();#ifdef CONFIG_VIRTFS qemu_opts_foreach(qemu_find_opts("fsdev"),@@ -4271,6 +4269,9 @@ void qemu_init(int argc, char **argv, char **envp)if (foreach_device_config (DEV_DEBUGCON , debugcon_parse) <0 )exit (1 ); +/* now chardevs have been created we may have semihosting to connect */ +qemu_semihosting_connect_chardevs (); +/* If no default VGA is requested, the default is "none". */ if (default_vga) { vga_model =get_default_vga_model (machine_class);
Signature · 1 line
Alex Bennée
Le 6/16/20 à 4:52 PM, Alex Bennée a écrit :
Quoted 12 lines
Quoted 3 lines · [email protected] writes:
From: KONRAD Frederic <[email protected]>
With that we can just use chardev=serial0.
I don't quite follow what this means.
./aarch64-softmmu/qemu-system-aarch64 -cpu max -monitor none -chardev=serial0 -M virt -display none -semihosting -kernel ./tests/tcg/aarch64-softmmu/memory
qemu-system-aarch64: -chardev=serial0: invalid option
Quoted 8 lines
./aarch64-softmmu/qemu-system-aarch64 -cpu max -monitor none -chardev id=serial0 -M virt -display none -semihosting -kernel ./tests/tcg/aarch64-softmmu/memory
qemu-system-aarch64: -chardev id=serial0: chardev: "serial0" missing backendThe run:
./aarch64-softmmu/qemu-system-aarch64 -cpu max -serial mon:stdio -M virt -display none -semihosting -kernel ./tests/tcg/aarch64-softmmu/memory
works fine without this patch.
Hi Alex, and sorry for the delay,
I meant -semihosting-config chardev=serial0. I suspect your last command-line will print any string sent to semihosting to stderr by default.
Quoted 32 lines
Quoted 30 lines
Signed-off-by KONRAD Frederic <[email protected]>--- softmmu/vl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)softmmu/vl.c +3
-2@@ -4123,8 +4123,6 @@ void qemu_init(int argc, char **argv, char **envp)qemu_opts_foreach (qemu_find_opts ("chardev" ), chardev_init_func,NULL , &error_fatal); -/* now chardevs have been created we may have semihosting to connect */ -qemu_semihosting_connect_chardevs ();#ifdef CONFIG_VIRTFS qemu_opts_foreach(qemu_find_opts("fsdev"),@@ -4271,6 +4269,9 @@ void qemu_init(int argc, char **argv, char **envp)if (foreach_device_config (DEV_DEBUGCON , debugcon_parse) <0 )exit (1 ); +/* now chardevs have been created we may have semihosting to connect */ +qemu_semihosting_connect_chardevs (); +/* If no default VGA is requested, the default is "none". */ if (default_vga) { vga_model =get_default_vga_model (machine_class);
Le 6/26/20 à 12:06 PM, Fred Konrad a écrit :
Quoted 24 lines
Le 6/16/20 à 4:52 PM, Alex Bennée a écrit :
Quoted 21 lines
Quoted 3 lines · [email protected] writes:
From: KONRAD Frederic <[email protected]>
With that we can just use chardev=serial0.
I don't quite follow what this means.
./aarch64-softmmu/qemu-system-aarch64 -cpu max -monitor none -chardev=serial0 -M virt -display none -semihosting -kernel ./tests/tcg/aarch64-softmmu/memory
qemu-system-aarch64: -chardev=serial0: invalid option./aarch64-softmmu/qemu-system-aarch64 -cpu max -monitor none -chardev id=serial0 -M virt -display none -semihosting -kernel ./tests/tcg/aarch64-softmmu/memory
qemu-system-aarch64: -chardev id=serial0: chardev: "serial0" missing backendThe run:
./aarch64-softmmu/qemu-system-aarch64 -cpu max -serial mon:stdio -M virt -display none -semihosting -kernel ./tests/tcg/aarch64-softmmu/memory
Quoted 6 lines
Quoted 1 line
works fine without this patch.
Hi Alex, and sorry for the delay,
I meant
-semihosting-config chardev=serial0. I suspect your last command-line will print any string sent to semihosting to stderr by default.
Does that make sense? BTW the second patch fixes a bug, it might be interesting to have it in 5.1.
Cheers,
Fred
Quoted 30 lines
Quoted 30 lines
Quoted 28 lines
Signed-off-by KONRAD Frederic <[email protected]>---
softmmu/vl.c| 5 +++--1 file changed, 3 insertions(+), 2 deletions(-)softmmu/vl.c +3
-2@@ -4123,8 +4123,6 @@ void qemu_init(int argc, char **argv, char **envp) qemu_opts_foreach(qemu_find_opts("chardev"), chardev_init_func, NULL, &error_fatal); - /* now chardevs have been created we may have semihosting to connect */ - qemu_semihosting_connect_chardevs(); #ifdef CONFIG_VIRTFS qemu_opts_foreach(qemu_find_opts("fsdev"),@@ -4271,6 +4269,9 @@ void qemu_init(int argc, char **argv, char **envp) if (foreach_device_config(DEV_DEBUGCON, debugcon_parse) < 0) exit(1); + /* now chardevs have been created we may have semihosting to connect */ + qemu_semihosting_connect_chardevs(); + /* If no default VGA is requested, the default is "none". */ if (default_vga) { vga_model = get_default_vga_model(machine_class);
Alex Bennée
AppliedQuoted 31 lines · Fred Konrad
Quoted 30 lines · Fred Konrad
Quoted 18 lines · Alex Bennée
Quoted 3 lines · [email protected] writes:
From: KONRAD Frederic <[email protected]>
With that we can just use chardev=serial0.
I don't quite follow what this means.
./aarch64-softmmu/qemu-system-aarch64 -cpu max -monitor none -chardev=serial0 -M virt -display none -semihosting -kernel ./tests/tcg/aarch64-softmmu/memory
qemu-system-aarch64: -chardev=serial0: invalid option./aarch64-softmmu/qemu-system-aarch64 -cpu max -monitor none -chardev id=serial0 -M virt -display none -semihosting -kernel ./tests/tcg/aarch64-softmmu/memory
qemu-system-aarch64: -chardev id=serial0: chardev: "serial0" missing backendQuoted 6 lines
The run:
./aarch64-softmmu/qemu-system-aarch64 -cpu max -serial mon:stdio -M virt -display none -semihosting -kernel ./tests/tcg/aarch64-softmmu/memory
works fine without this patch.
Hi Alex, and sorry for the delay,
Quoted 5 lines
Quoted 2 lines
I meant
-semihosting-config chardev=serial0. I suspect your last command-line will print any string sent to semihosting to stderr by default.Does that make sense? BTW the second patch fixes a bug, it might be interesting to have it in 5.1.
Right - can confirm the difference between:
./aarch64-softmmu/qemu-system-aarch64 -cpu max -serial mon:stdio -M virt -display none -semihosting -kernel ./tests/tcg/aarch64-softmmu/memory
and
./aarch64-softmmu/qemu-system-aarch64 -cpu max -serial mon:stdio -M virt -display none -semihosting-config chardev=serial0 -kernel ./tests/tcg/aarch64-softmmu/memory
is where the data ends up. I've slightly amended the commit message for the 1/1 to make it clearer.
Queued to for-5.1/fixes-for-rc1, thanks.
Quoted 34 lines
Cheers,
FredQuoted 30 lines
Quoted 30 lines
Quoted 28 lines
Signed-off-by KONRAD Frederic <[email protected]>--- softmmu/vl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)softmmu/vl.c +3
-2@@ -4123,8 +4123,6 @@ void qemu_init(int argc, char **argv, char **envp)qemu_opts_foreach (qemu_find_opts ("chardev" ), chardev_init_func,NULL , &error_fatal); -/* now chardevs have been created we may have semihosting to connect */ -qemu_semihosting_connect_chardevs ();#ifdef CONFIG_VIRTFS qemu_opts_foreach(qemu_find_opts("fsdev"),@@ -4271,6 +4269,9 @@ void qemu_init(int argc, char **argv, char **envp)if (foreach_device_config (DEV_DEBUGCON , debugcon_parse) <0 )exit (1 ); +/* now chardevs have been created we may have semihosting to connect */ +qemu_semihosting_connect_chardevs (); +/* If no default VGA is requested, the default is "none". */ if (default_vga) { vga_model =get_default_vga_model (machine_class);
Signature · 1 line
Alex Bennée