From: Magnus Damm <magnus.damm@gmail.com>
To: linux-sh@vger.kernel.org
Subject: [PATCH] sh: add byte support to the sign extension code
Date: Thu, 07 Feb 2008 10:58:46 +0000 [thread overview]
Message-ID: <20080207105846.9562.55554.sendpatchset@clockwork.opensource.se> (raw)
This patch adds byte support to the sign extension code. Unaligned access
traps should never be generated on 8-bit io operations, but we will use this
code for trapped io and we do need byte support there.
Signed-off-by: Magnus Damm <damm@igel.co.jp>
---
arch/sh/kernel/traps_32.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
--- 0001/arch/sh/kernel/traps_32.c
+++ work/arch/sh/kernel/traps_32.c 2008-02-07 15:38:46.000000000 +0900
@@ -150,14 +150,24 @@ static int die_if_no_fixup(const char *
static inline void sign_extend(unsigned int count, unsigned char *dst)
{
#ifdef __LITTLE_ENDIAN__
+ if ((count = 1) && dst[0] & 0x80) {
+ dst[1] = 0xff;
+ dst[2] = 0xff;
+ dst[3] = 0xff;
+ }
if ((count = 2) && dst[1] & 0x80) {
dst[2] = 0xff;
dst[3] = 0xff;
}
#else
- if ((count = 2) && dst[2] & 0x80) {
+ if ((count = 1) && dst[3] & 0x80) {
+ dst[2] = 0xff;
+ dst[1] = 0xff;
dst[0] = 0xff;
+ }
+ if ((count = 2) && dst[2] & 0x80) {
dst[1] = 0xff;
+ dst[0] = 0xff;
}
#endif
}
reply other threads:[~2008-02-07 10:58 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=20080207105846.9562.55554.sendpatchset@clockwork.opensource.se \
--to=magnus.damm@gmail.com \
--cc=linux-sh@vger.kernel.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