From: Daniel Jacobowitz <dan@debian.org>
To: Ralf Baechle <ralf@linux-mips.org>
Cc: Pavel Kiryukhin <savl@dev.rtsoft.ru>, linux-mips@linux-mips.org
Subject: Re: __MIPSEL__ in sys32_rt_sigtimedwait
Date: Tue, 20 Jan 2004 14:39:18 -0500 [thread overview]
Message-ID: <20040120193918.GA2108@nevyn.them.org> (raw)
In-Reply-To: <20040120183157.GB5495@linux-mips.org>
On Tue, Jan 20, 2004 at 07:31:57PM +0100, Ralf Baechle wrote:
> On Tue, Jan 20, 2004 at 08:42:15PM +0300, Pavel Kiryukhin wrote:
>
> > Hi all,
> > my question - does endiannes matters in sigset translation in
> > sys32_rt_sigtimedwait (arch/mips/signal32.c)?
>
> Think about where bit 33 ends for a big endian machine with an without
> the conversion.
No, I'm pretty sure Pavel's right.
-#ifdef __MIPSEB__
case 1: these.sig[0] = these32.sig[0] | (((long)these32.sig[1]) << 32);
-#endif
-#ifdef __MIPSEL__
- case 1: these.sig[0] = these32.sig[1] | (((long)these32.sig[0]) << 32);
-#endif
Consider a 64-bit sigset. 32-bit userland, 64-bit kernel. Here's a
userland sigset with signal 33 set, only, on a little endian target.
Word 1, least significant bit, right?
byte address in memory
1 2 3 4 5 6 7 8
val 0 0 0 0 0 0 0 1
Obviously, as a 64-bit integer the sigset looks different. There it's
supposed to be 1 << (33 - 1).
val 0 0 0 1 0 0 0 0
So the correct algorithm to convert a userspace sigset to a kernel
sigset is to shift the second word left 32 bits, and leave the first
word right aligned, and or them together. Which is what using the
__MIPSEB__ case does.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
next prev parent reply other threads:[~2004-01-20 19:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-20 17:42 __MIPSEL__ in sys32_rt_sigtimedwait Pavel Kiryukhin
2004-01-20 18:31 ` Ralf Baechle
2004-01-20 19:39 ` Daniel Jacobowitz [this message]
2004-01-21 13:47 ` Maciej W. Rozycki
2004-01-21 15:22 ` Daniel Jacobowitz
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=20040120193918.GA2108@nevyn.them.org \
--to=dan@debian.org \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.org \
--cc=savl@dev.rtsoft.ru \
/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