From: Stuart Anderson <anderson@netsweng.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [mips-linux-user] patch for struct stat mapping
Date: Tue, 29 May 2007 22:30:53 -0400 (EDT) [thread overview]
Message-ID: <Pine.LNX.4.64.0705292227590.6270@trantor.stuart.netsweng.com> (raw)
[-- Attachment #1: Type: TEXT/PLAIN, Size: 505 bytes --]
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 anderson@netsweng.com
Network & Software Engineering http://www.netsweng.com/
1024D/37A79149: 0791 D3B8 9A4C 2CDC A31F
BD03 0A62 E534 37A7 9149
[-- Attachment #2: MIPS struct stat mapping patch --]
[-- Type: TEXT/x-diff, Size: 1482 bytes --]
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 other threads:[~2007-05-30 2:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0705292227590.6270@trantor.stuart.netsweng.com \
--to=anderson@netsweng.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).