From e35846583b6aaa4ac7f6ac90139d0952f2dee2d8 Mon Sep 17 00:00:00 2001 From: ths Date: Fri, 1 Jun 2007 11:49:38 +0000 Subject: [PATCH] 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 --- linux-user/syscall.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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);