The code that maps struct stat is wrong for MIPS. It uses the wrong
sized calls (16 vs 32) for swapping some of the structure members. A
patch to fix this is attached.


                                Stuart

Stuart R. Anderson                               [EMAIL PROTECTED]
Network & Software Engineering                   http://www.netsweng.com/
1024D/37A79149:                                  0791 D3B8 9A4C 2CDC A31F
                                                 BD03 0A62 E534 37A7 9149
Index: qemu/linux-user/syscall.c
===================================================================
--- qemu.orig/linux-user/syscall.c	2007-05-29 22:17:15.000000000 -0400
+++ qemu/linux-user/syscall.c	2007-05-29 22:18:16.000000000 -0400
@@ -3698,7 +3698,11 @@
                 
                 lock_user_struct(target_st, arg2, 0);
                 if( ret=page_check_range(target_st,sizeof(*target_st),PAGE_WRITE) ) return -ret;
+#if defined(TARGET_MIPS)
+                target_st->st_dev = tswapl(st.st_dev);
+#else
                 target_st->st_dev = tswap16(st.st_dev);
+#endif
                 target_st->st_ino = tswapl(st.st_ino);
 #if defined(TARGET_PPC) || defined(TARGET_MIPS)
                 target_st->st_mode = tswapl(st.st_mode); /* XXX: check this */
@@ -3709,8 +3713,14 @@
                 target_st->st_uid = tswap16(st.st_uid);
                 target_st->st_gid = tswap16(st.st_gid);
 #endif
+#if defined(TARGET_MIPS)
+		/* If this is the same on PPC, then just merge w/ the above ifdef */
+                target_st->st_nlink = tswapl(st.st_nlink);
+                target_st->st_rdev = tswapl(st.st_rdev);
+#else
                 target_st->st_nlink = tswap16(st.st_nlink);
                 target_st->st_rdev = tswap16(st.st_rdev);
+#endif
                 target_st->st_size = tswapl(st.st_size);
                 target_st->st_blksize = tswapl(st.st_blksize);
                 target_st->st_blocks = tswapl(st.st_blocks);

Reply via email to