qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: michael <trimarchi@gandalf.sssup.it>
To: qemu-devel@nongnu.org
Cc: takasi-y@ops.dti.ne.jp
Subject: Re: [Qemu-devel] [PATCH] SH: Fix struct target_stat64 for 64bit host
Date: Mon, 20 Oct 2008 19:35:34 +0200	[thread overview]
Message-ID: <48FCC166.4080200@gandalf.sssup.it> (raw)
In-Reply-To: <200810201131.m9KBV7MM024318@smtp12.dti.ne.jp>

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

hi,

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;
>  	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;
>  
>  	abi_ulong	st_uid;
>  	abi_ulong	st_gid;
>   
What would you think about this one?



[-- Attachment #2: stat64_patch --]
[-- Type: text/plain, Size: 390 bytes --]

Index: linux-user/syscall_defs.h
===================================================================
--- linux-user/syscall_defs.h	(revision 5499)
+++ linux-user/syscall_defs.h	(working copy)
@@ -1506,7 +1506,7 @@
 	abi_ulong	target_st_ctime_nsec;
 
 	unsigned long long	st_ino;
-};
+}  __attribute__((packed));
 
 #elif defined(TARGET_I386) && !defined(TARGET_ABI32)
 struct target_stat {

  parent reply	other threads:[~2008-10-20 17:35 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   ` [Qemu-devel] " michael
2008-10-20 17:35   ` michael [this message]
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=48FCC166.4080200@gandalf.sssup.it \
    --to=trimarchi@gandalf.sssup.it \
    --cc=qemu-devel@nongnu.org \
    --cc=takasi-y@ops.dti.ne.jp \
    /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 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).