From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KryPS-0004vc-1c for qemu-devel@nongnu.org; Mon, 20 Oct 2008 13:19:14 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KryPQ-0004vN-DB for qemu-devel@nongnu.org; Mon, 20 Oct 2008 13:19:13 -0400 Received: from [199.232.76.173] (port=42060 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KryPQ-0004vJ-8P for qemu-devel@nongnu.org; Mon, 20 Oct 2008 13:19:12 -0400 Received: from ms01.sssup.it ([193.205.80.99]:58900 helo=sssup.it) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KryPQ-0006WZ-Hf for qemu-devel@nongnu.org; Mon, 20 Oct 2008 13:19:12 -0400 Received: from [193.205.82.7] (HELO gandalf.sssup.it) by sssup.it (CommuniGate Pro SMTP 4.1.8) with ESMTP-TLS id 46001926 for qemu-devel@nongnu.org; Mon, 20 Oct 2008 19:18:01 +0200 Received: from [10.30.3.184] (vpn01.retis [10.30.3.184]) by gandalf.sssup.it (8.12.10/8.12.10) with ESMTP id m9KG9IVr017556 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 20 Oct 2008 18:09:22 +0200 Message-ID: <48FCBD7D.7060000@gandalf.sssup.it> Date: Mon, 20 Oct 2008 19:18:53 +0200 From: michael MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] SH: Fix struct target_stat64 for 64bit host References: <48F62D38.50001@gandalf.sssup.it> <200810201131.m9KBV7MM024318@smtp12.dti.ne.jp> In-Reply-To: <200810201131.m9KBV7MM024318@smtp12.dti.ne.jp> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 > > --- > 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