Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Krsyk-0007u3-KL for qemu-devel@nongnu.org; Mon, 20 Oct 2008 07:31:18 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Krsyj-0007td-6B for qemu-devel@nongnu.org; Mon, 20 Oct 2008 07:31:18 -0400 Received: from [199.232.76.173] (port=45605 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Krsyj-0007ta-0Q for qemu-devel@nongnu.org; Mon, 20 Oct 2008 07:31:17 -0400 Received: from smtp12.dti.ne.jp ([202.216.231.187]:60227) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Krsyi-0002sk-Fl for qemu-devel@nongnu.org; Mon, 20 Oct 2008 07:31:16 -0400 Date: Mon, 20 Oct 2008 20:31:07 +0900 (JST) Message-Id: <200810201131.m9KBV7MM024318@smtp12.dti.ne.jp> From: takasi-y@ops.dti.ne.jp In-Reply-To: <48F62D38.50001@gandalf.sssup.it> References: <48F62D38.50001@gandalf.sssup.it> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH] SH: Fix struct target_stat64 for 64bit host 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 Cc: michael 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; 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; -- 1.5.4.3