qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] SH: Fix struct target_stat64 for 64bit host


From: takasi-y
Subject: [Qemu-devel] [PATCH] SH: Fix struct target_stat64 for 64bit host
Date: Mon, 20 Oct 2008 20:31:07 +0900 (JST)

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 <address@hidden>

---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]