diff options
author | Magnus Damm <magnus.damm@gmail.com> | 2008-02-07 05:58:46 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2008-02-14 00:22:09 -0500 |
commit | 4252c659a4e7f4260e4bdc87538578236c51ab2d (patch) | |
tree | 0b85509081e8ad05db5514bccaa71f384dfa92bd | |
parent | 1e6760c5c4589d02a6877fb256b99c33dd8f1ede (diff) |
sh: add byte support to the sign extension code
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>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r-- | arch/sh/kernel/traps_32.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/arch/sh/kernel/traps_32.c b/arch/sh/kernel/traps_32.c index 7154a7b2135b..2e7dd2ebec9a 100644 --- a/arch/sh/kernel/traps_32.c +++ b/arch/sh/kernel/traps_32.c | |||
@@ -150,14 +150,24 @@ static int die_if_no_fixup(const char * str, struct pt_regs * regs, long err) | |||
150 | static inline void sign_extend(unsigned int count, unsigned char *dst) | 150 | static inline void sign_extend(unsigned int count, unsigned char *dst) |
151 | { | 151 | { |
152 | #ifdef __LITTLE_ENDIAN__ | 152 | #ifdef __LITTLE_ENDIAN__ |
153 | if ((count == 1) && dst[0] & 0x80) { | ||
154 | dst[1] = 0xff; | ||
155 | dst[2] = 0xff; | ||
156 | dst[3] = 0xff; | ||
157 | } | ||
153 | if ((count == 2) && dst[1] & 0x80) { | 158 | if ((count == 2) && dst[1] & 0x80) { |
154 | dst[2] = 0xff; | 159 | dst[2] = 0xff; |
155 | dst[3] = 0xff; | 160 | dst[3] = 0xff; |
156 | } | 161 | } |
157 | #else | 162 | #else |
158 | if ((count == 2) && dst[2] & 0x80) { | 163 | if ((count == 1) && dst[3] & 0x80) { |
164 | dst[2] = 0xff; | ||
165 | dst[1] = 0xff; | ||
159 | dst[0] = 0xff; | 166 | dst[0] = 0xff; |
167 | } | ||
168 | if ((count == 2) && dst[2] & 0x80) { | ||
160 | dst[1] = 0xff; | 169 | dst[1] = 0xff; |
170 | dst[0] = 0xff; | ||
161 | } | 171 | } |
162 | #endif | 172 | #endif |
163 | } | 173 | } |