All of lore.kernel.org
 help / color / mirror / Atom feed
From: michael <trimarchi@gandalf.sssup.it>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] SH: Fix struct target_stat64 for 64bit host
Date: Mon, 20 Oct 2008 19:18:53 +0200	[thread overview]
Message-ID: <48FCBD7D.7060000@gandalf.sssup.it> (raw)
In-Reply-To: <200810201131.m9KBV7MM024318@smtp12.dti.ne.jp>

takasi-y@ops.dti.ne.jp wrote:
> Hi,
>
>   
>> I have some trouble using the qemu emulator on the x86_64 host system. 
>> The system emulate
>> an qemu-sh4 machine. I try to fix it without success:
>>     
>
> I found stat64 has damaged return address on stack because of bloated
>  struct stat64.
>
> On sh4 target, struct target_stat64 has "unsigned int" as its member.
> It may results unwanted struct layout on 64bit host. Switched to abi_ulong.
> We also have to use packed attribute for sh4, because the struct has
> unaligned 64bit member st_size.
>
>  Signed-off-by: Takashi YOSHII <takasi-y@ops.dti.ne.jp>
>
> ---
>  linux-user/syscall_defs.h |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index 5a58010..01e48fd 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -1475,15 +1475,15 @@ struct target_stat {
>  /* This matches struct stat64 in glibc2.1, hence the absolutely
>   * insane amounts of padding around dev_t's.
>   */
> -struct target_stat64 {
> +struct __attribute__((__packed__)) target_stat64 {
>  	unsigned long long	st_dev;
>   
Define it packets assecure me that each type occopies the exact dimension
>  	unsigned char	__pad0[4];
>  
>  #define TARGET_STAT64_HAS_BROKEN_ST_INO	1
>  	abi_ulong	__st_ino;
>  
> -	unsigned int	st_mode;
> -	unsigned int	st_nlink;
> +	abi_ulong	st_mode;
> +	abi_ulong	st_nlink;
>   
The size of an unsigned int is 4 byte and is ok? Why this change?
>  
>  	abi_ulong	st_uid;
>  	abi_ulong	st_gid;
>   

Regards Michael

  parent reply	other threads:[~2008-10-20 17:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-15 17:49 [Qemu-devel] sh4 linux user emulation on an x86_64 system michael
2008-10-15 18:46 ` Vince Weaver
2008-10-15 20:53   ` michael
2008-10-20 11:31 ` [Qemu-devel] [PATCH] SH: Fix struct target_stat64 for 64bit host takasi-y
2008-10-20 13:52   ` [Qemu-devel] " michael
2008-10-20 17:18   ` michael [this message]
2008-10-20 17:35   ` [Qemu-devel] " michael
2008-10-21  3:48     ` [Qemu-devel] " takasi-y
2008-10-26 15:37   ` [Qemu-devel] [PATCH] take2. " takasi-y
2009-01-30 19:48     ` Aurelien Jarno

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48FCBD7D.7060000@gandalf.sssup.it \
    --to=trimarchi@gandalf.sssup.it \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.