Skip to contentSkip to conversation

SH4 issue and fstat64

Qemu-devel Laurent Desnogues 2 participants 2 messages Jan 9, 2009 – Jan 10, 2009

lore
Share & tools
lore
#0 lore raw

Hello,

after spending two hours to find and fix a simple hello world program failed on sh4, I found the issue had already been found:

http://www.nabble.com/sh4-linux-user-emulation-on-an-x86_64-system-td19998891.html

I can confirm that the packing of the structure proposed by Takashi Yoshii and Michael Trimarchi fixes the problem on my x86_64 system. I also checked it does not break i386 qemu on my machine.

If someone needs a reproducer feel free to contact me.

This could have been frustrating, but now I know a little bit of sh4, so that was not useless :-)

Laurent

#1 lore raw
Quoted 10 lines · Laurent Desnogues

Hello,

after spending two hours to find and fix a simple hello world program failed on sh4, I found the issue had already been found:

http://www.nabble.com/sh4-linux-user-emulation-on-an-x86_64-system-td19998891.html

I can confirm that the packing of the structure proposed by Takashi Yoshii and Michael Trimarchi fixes the problem on my x86_64 system. I also checked it does not break i386 qemu on my machine.

I can confirm the fix as well. For the record, this is the patch I used:

linux-user/syscall_defs.h +1 -1
index 86c9d82..ba9ef8d 100644
@@ -1475,7 +1475,7 @@ 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];
 
Signature · 2 lines
Måns Rullgård
[email protected]