Commit e35846583b6aaa4ac7f6ac90139d0952f2dee2d8

Authored by ths
1 parent a7037b29

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
Showing 1 changed file with 11 additions and 1 deletions
linux-user/syscall.c
... ... @@ -3108,9 +3108,13 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
3108 3108 do_stat:
3109 3109 if (!is_error(ret)) {
3110 3110 struct target_stat *target_st;
3111   -
  3111 +
3112 3112 lock_user_struct(target_st, arg2, 0);
  3113 +#if defined(TARGET_MIPS)
  3114 + target_st->st_dev = tswap32(st.st_dev);
  3115 +#else
3113 3116 target_st->st_dev = tswap16(st.st_dev);
  3117 +#endif
3114 3118 target_st->st_ino = tswapl(st.st_ino);
3115 3119 #if defined(TARGET_PPC) || defined(TARGET_MIPS)
3116 3120 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,
3121 3125 target_st->st_uid = tswap16(st.st_uid);
3122 3126 target_st->st_gid = tswap16(st.st_gid);
3123 3127 #endif
  3128 +#if defined(TARGET_MIPS)
  3129 + /* If this is the same on PPC, then just merge w/ the above ifdef */
  3130 + target_st->st_nlink = tswapl(st.st_nlink);
  3131 + target_st->st_rdev = tswapl(st.st_rdev);
  3132 +#else
3124 3133 target_st->st_nlink = tswap16(st.st_nlink);
3125 3134 target_st->st_rdev = tswap16(st.st_rdev);
  3135 +#endif
3126 3136 target_st->st_size = tswapl(st.st_size);
3127 3137 target_st->st_blksize = tswapl(st.st_blksize);
3128 3138 target_st->st_blocks = tswapl(st.st_blocks);
... ...