qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Fix struct termios host - target translation
@ 2009-04-19 20:38 Arnaud Patard
  2009-04-20 13:14 ` Riku Voipio
  0 siblings, 1 reply; 2+ messages in thread
From: Arnaud Patard @ 2009-04-19 20:38 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 355 bytes --]


When converting the termios structure between host and target in
target_to_host_termios and host_to_target_termios, the c_cc[] array is
never initialised.
Calling memset() before using it allows to run successfully "stty echo /
stty -echo" on arm-linux-user target (host being x86 and mips).

Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
---

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: fix_termios.patch --]
[-- Type: text/x-diff, Size: 950 bytes --]

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 2d51d6b..2d876c1 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -2527,6 +2527,7 @@ static void target_to_host_termios (void *dst, const void *src)
         target_to_host_bitmask(tswap32(target->c_lflag), lflag_tbl);
     host->c_line = target->c_line;
 
+    memset(host->c_cc, 0, sizeof(host->c_cc));
     host->c_cc[VINTR] = target->c_cc[TARGET_VINTR];
     host->c_cc[VQUIT] = target->c_cc[TARGET_VQUIT];
     host->c_cc[VERASE] = target->c_cc[TARGET_VERASE];
@@ -2561,6 +2562,7 @@ static void host_to_target_termios (void *dst, const void *src)
         tswap32(host_to_target_bitmask(host->c_lflag, lflag_tbl));
     target->c_line = host->c_line;
 
+    memset(target->c_cc, 0, sizeof(target->c_cc));
     target->c_cc[TARGET_VINTR] = host->c_cc[VINTR];
     target->c_cc[TARGET_VQUIT] = host->c_cc[VQUIT];
     target->c_cc[TARGET_VERASE] = host->c_cc[VERASE];


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] Fix struct termios host - target translation
  2009-04-19 20:38 [Qemu-devel] [PATCH] Fix struct termios host - target translation Arnaud Patard
@ 2009-04-20 13:14 ` Riku Voipio
  0 siblings, 0 replies; 2+ messages in thread
From: Riku Voipio @ 2009-04-20 13:14 UTC (permalink / raw)
  To: qemu-devel

On Sun, Apr 19, 2009 at 10:38:47PM +0200, Arnaud Patard wrote:
> When converting the termios structure between host and target in
> target_to_host_termios and host_to_target_termios, the c_cc[] array is
> never initialised.
> Calling memset() before using it allows to run successfully "stty echo /
> stty -echo" on arm-linux-user target (host being x86 and mips).

Looks correct to me, and can verify that stty now works better on arm/amd64
target/host combo.

Acked-by: Riku Voipio <riku.voipio@iki.fi>

> Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
> ---

> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 2d51d6b..2d876c1 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -2527,6 +2527,7 @@ static void target_to_host_termios (void *dst, const void *src)
>          target_to_host_bitmask(tswap32(target->c_lflag), lflag_tbl);
>      host->c_line = target->c_line;
>  
> +    memset(host->c_cc, 0, sizeof(host->c_cc));
>      host->c_cc[VINTR] = target->c_cc[TARGET_VINTR];
>      host->c_cc[VQUIT] = target->c_cc[TARGET_VQUIT];
>      host->c_cc[VERASE] = target->c_cc[TARGET_VERASE];
> @@ -2561,6 +2562,7 @@ static void host_to_target_termios (void *dst, const void *src)
>          tswap32(host_to_target_bitmask(host->c_lflag, lflag_tbl));
>      target->c_line = host->c_line;
>  
> +    memset(target->c_cc, 0, sizeof(target->c_cc));
>      target->c_cc[TARGET_VINTR] = host->c_cc[VINTR];
>      target->c_cc[TARGET_VQUIT] = host->c_cc[VQUIT];
>      target->c_cc[TARGET_VERASE] = host->c_cc[VERASE];
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-04-20 13:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-19 20:38 [Qemu-devel] [PATCH] Fix struct termios host - target translation Arnaud Patard
2009-04-20 13:14 ` Riku Voipio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).