aboutsummaryrefslogtreecommitdiff
path: root/linux-user
diff options
context:
space:
mode:
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-06-01 11:49:38 +0000
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-06-01 11:49:38 +0000
commite35846583b6aaa4ac7f6ac90139d0952f2dee2d8 (patch)
treedfd8c78b9edfbaa512f6f23f0110840b0c2b13a8 /linux-user
parenta7037b2950629ab1a305a7f5c6909e749d72b5d0 (diff)
Fix struct stat mapping for MIPS, by Stuart Anderson.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2906 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'linux-user')
-rw-r--r--linux-user/syscall.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index abefe856bb..c80f329c21 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -3108,9 +3108,13 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
do_stat:
if (!is_error(ret)) {
struct target_stat *target_st;
-
+
lock_user_struct(target_st, arg2, 0);
+#if defined(TARGET_MIPS)
+ target_st->st_dev = tswap32(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 */
@@ -3121,8 +3125,14 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
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);