aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh
diff options
context:
space:
mode:
authorStuart Menefy <stuart.menefy@st.com>2009-08-24 04:09:53 -0400
committerPaul Mundt <lethal@linux-sh.org>2009-08-24 04:09:53 -0400
commitfea966f7564205fcf5919af9bde031e753419c96 (patch)
treeeb04727dfaad0c42bf9ba771e38f07c310622120 /arch/sh
parentd724a9c9d572e092d1ce820463f082697487b874 (diff)
sh: Remove implicit sign extension from assembler immediates
The SH instruction set has several instructions which accept an 8 bit immediate operand. For logical instructions this operand is zero extended, for arithmetic instructions the operand is sign extended. After adding an option to the assembler to check this, it was found that several pieces of assembly code were assuming this behaviour, and in one case getting it wrong. So this patch explicitly sign extends any immediate operands, which makes it obvious what is happening, and fixes the one case which got it wrong. Signed-off-by: Stuart Menefy <stuart.menefy@st.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/boot/compressed/head_32.S2
-rw-r--r--arch/sh/include/asm/entry-macros.S2
-rw-r--r--arch/sh/kernel/cpu/sh3/entry.S2
-rw-r--r--arch/sh/kernel/entry-common.S5
-rw-r--r--arch/sh/lib/clear_page.S2
5 files changed, 7 insertions, 6 deletions
diff --git a/arch/sh/boot/compressed/head_32.S b/arch/sh/boot/compressed/head_32.S
index 06ac31f3be8..02a30935f0b 100644
--- a/arch/sh/boot/compressed/head_32.S
+++ b/arch/sh/boot/compressed/head_32.S
@@ -22,7 +22,7 @@ startup:
22 bt clear_bss 22 bt clear_bss
23 sub r0, r2 23 sub r0, r2
24 mov.l bss_start_addr, r0 24 mov.l bss_start_addr, r0
25 mov #0xe0, r1 25 mov #0xffffffe0, r1
26 and r1, r0 ! align cache line 26 and r1, r0 ! align cache line
27 mov.l text_start_addr, r3 27 mov.l text_start_addr, r3
28 mov r0, r1 28 mov r0, r1
diff --git a/arch/sh/include/asm/entry-macros.S b/arch/sh/include/asm/entry-macros.S
index 64fd0de24da..cc43a55e1fc 100644
--- a/arch/sh/include/asm/entry-macros.S
+++ b/arch/sh/include/asm/entry-macros.S
@@ -7,7 +7,7 @@
7 .endm 7 .endm
8 8
9 .macro sti 9 .macro sti
10 mov #0xf0, r11 10 mov #0xfffffff0, r11
11 extu.b r11, r11 11 extu.b r11, r11
12 not r11, r11 12 not r11, r11
13 stc sr, r10 13 stc sr, r10
diff --git a/arch/sh/kernel/cpu/sh3/entry.S b/arch/sh/kernel/cpu/sh3/entry.S
index 8c19e21847d..9421ec715fd 100644
--- a/arch/sh/kernel/cpu/sh3/entry.S
+++ b/arch/sh/kernel/cpu/sh3/entry.S
@@ -257,7 +257,7 @@ restore_all:
257 ! 257 !
258 ! Calculate new SR value 258 ! Calculate new SR value
259 mov k3, k2 ! original SR value 259 mov k3, k2 ! original SR value
260 mov #0xf0, k1 260 mov #0xfffffff0, k1
261 extu.b k1, k1 261 extu.b k1, k1
262 not k1, k1 262 not k1, k1
263 and k1, k2 ! Mask original SR value 263 and k1, k2 ! Mask original SR value
diff --git a/arch/sh/kernel/entry-common.S b/arch/sh/kernel/entry-common.S
index 700477601c6..68d9223b145 100644
--- a/arch/sh/kernel/entry-common.S
+++ b/arch/sh/kernel/entry-common.S
@@ -98,8 +98,9 @@ need_resched:
98 98
99 mov #OFF_SR, r0 99 mov #OFF_SR, r0
100 mov.l @(r0,r15), r0 ! get status register 100 mov.l @(r0,r15), r0 ! get status register
101 and #0xf0, r0 ! interrupts off (exception path)? 101 shlr r0
102 cmp/eq #0xf0, r0 102 and #(0xf0>>1), r0 ! interrupts off (exception path)?
103 cmp/eq #(0xf0>>1), r0
103 bt noresched 104 bt noresched
104 mov.l 3f, r0 105 mov.l 3f, r0
105 jsr @r0 ! call preempt_schedule_irq 106 jsr @r0 ! call preempt_schedule_irq
diff --git a/arch/sh/lib/clear_page.S b/arch/sh/lib/clear_page.S
index 8342bfbde64..c92244d4ff9 100644
--- a/arch/sh/lib/clear_page.S
+++ b/arch/sh/lib/clear_page.S
@@ -57,7 +57,7 @@ ENTRY(clear_page)
57ENTRY(__clear_user) 57ENTRY(__clear_user)
58 ! 58 !
59 mov #0, r0 59 mov #0, r0
60 mov #0xe0, r1 ! 0xffffffe0 60 mov #0xffffffe0, r1
61 ! 61 !
62 ! r4..(r4+31)&~32 -------- not aligned [ Area 0 ] 62 ! r4..(r4+31)&~32 -------- not aligned [ Area 0 ]
63 ! (r4+31)&~32..(r4+r5)&~32 -------- aligned [ Area 1 ] 63 ! (r4+31)&~32..(r4+r5)&~32 -------- aligned [ Area 1 ]