qemu-devel
[Top][All Lists]
Advanced

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

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


From: michael
Subject: Re: [Qemu-devel] [PATCH] SH: Fix struct target_stat64 for 64bit host
Date: Mon, 20 Oct 2008 19:35:34 +0200
User-agent: Mozilla-Thunderbird 2.0.0.16 (X11/20080724)

hi,

address@hidden 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 <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;
What would you think about this one?


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 {

reply via email to

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