diff options
author | Magnus Damm <damm@igel.co.jp> | 2009-02-23 02:15:07 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-02-27 02:26:14 -0500 |
commit | 1dd22722f6bf9be9821657a2d59fae4d4365fb32 (patch) | |
tree | 807cf326ee1b1786d65d37190b5733ba741cb54d /arch/sh/kernel/cpu/sh3/entry.S | |
parent | 1d015cf02a1fd46385c03cf3ce8958dbea705dd3 (diff) |
sh: rework register restore code for sh3/sh4/sh4a
This patch reworks the sh3/sh4/sh4a register restore code in
the following ways:
- break out restore_regs() from restore_all()
- the register saving order is unchanged
- use restore_regs() in sh_bios_handler and restore_all
- document the function
Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/kernel/cpu/sh3/entry.S')
-rw-r--r-- | arch/sh/kernel/cpu/sh3/entry.S | 68 |
1 files changed, 33 insertions, 35 deletions
diff --git a/arch/sh/kernel/cpu/sh3/entry.S b/arch/sh/kernel/cpu/sh3/entry.S index f3db143e70b2..cbffbffce351 100644 --- a/arch/sh/kernel/cpu/sh3/entry.S +++ b/arch/sh/kernel/cpu/sh3/entry.S | |||
@@ -188,44 +188,35 @@ call_dae: | |||
188 | #if defined(CONFIG_SH_STANDARD_BIOS) | 188 | #if defined(CONFIG_SH_STANDARD_BIOS) |
189 | /* Unwind the stack and jmp to the debug entry */ | 189 | /* Unwind the stack and jmp to the debug entry */ |
190 | ENTRY(sh_bios_handler) | 190 | ENTRY(sh_bios_handler) |
191 | mov.l @r15+, r0 | 191 | mov.l 1f, r8 |
192 | mov.l @r15+, r1 | 192 | bsr restore_regs |
193 | mov.l @r15+, r2 | 193 | nop |
194 | mov.l @r15+, r3 | 194 | |
195 | mov.l @r15+, r4 | 195 | lds k2, pr ! restore pr |
196 | mov.l @r15+, r5 | 196 | mov k4, r15 |
197 | mov.l @r15+, r6 | ||
198 | mov.l @r15+, r7 | ||
199 | stc sr, r8 | ||
200 | mov.l 1f, r9 ! BL =1, RB=1, IMASK=0x0F | ||
201 | or r9, r8 | ||
202 | ldc r8, sr ! here, change the register bank | ||
203 | mov.l @r15+, r8 | ||
204 | mov.l @r15+, r9 | ||
205 | mov.l @r15+, r10 | ||
206 | mov.l @r15+, r11 | ||
207 | mov.l @r15+, r12 | ||
208 | mov.l @r15+, r13 | ||
209 | mov.l @r15+, r14 | ||
210 | mov.l @r15+, k0 | ||
211 | ldc.l @r15+, spc | ||
212 | lds.l @r15+, pr | ||
213 | mov.l @r15+, k1 | ||
214 | ldc.l @r15+, gbr | ||
215 | lds.l @r15+, mach | ||
216 | lds.l @r15+, macl | ||
217 | mov k0, r15 | ||
218 | ! | 197 | ! |
219 | mov.l 2f, k0 | 198 | mov.l 2f, k0 |
220 | mov.l @k0, k0 | 199 | mov.l @k0, k0 |
221 | jmp @k0 | 200 | jmp @k0 |
222 | ldc k1, ssr | 201 | ldc k3, ssr |
223 | .align 2 | 202 | .align 2 |
224 | 1: .long 0x300000f0 | 203 | 1: .long 0x300000f0 |
225 | 2: .long gdb_vbr_vector | 204 | 2: .long gdb_vbr_vector |
226 | #endif /* CONFIG_SH_STANDARD_BIOS */ | 205 | #endif /* CONFIG_SH_STANDARD_BIOS */ |
227 | 206 | ||
228 | restore_all: | 207 | ! restore_regs() |
208 | ! - restore r0, r1, r2, r3, r4, r5, r6, r7 from the stack | ||
209 | ! - switch bank | ||
210 | ! - restore r8, r9, r10, r11, r12, r13, r14, r15 from the stack | ||
211 | ! - restore spc, pr*, ssr, gbr, mach, macl, skip default tra | ||
212 | ! k2 returns original pr | ||
213 | ! k3 returns original sr | ||
214 | ! k4 returns original stack pointer | ||
215 | ! r8 passes SR bitmask, overwritten with restored data on return | ||
216 | ! r9 trashed | ||
217 | ! BL=0 on entry, on exit BL=1 (depending on r8). | ||
218 | |||
219 | restore_regs: | ||
229 | mov.l @r15+, r0 | 220 | mov.l @r15+, r0 |
230 | mov.l @r15+, r1 | 221 | mov.l @r15+, r1 |
231 | mov.l @r15+, r2 | 222 | mov.l @r15+, r2 |
@@ -235,10 +226,9 @@ restore_all: | |||
235 | mov.l @r15+, r6 | 226 | mov.l @r15+, r6 |
236 | mov.l @r15+, r7 | 227 | mov.l @r15+, r7 |
237 | ! | 228 | ! |
238 | stc sr, r8 | 229 | stc sr, r9 |
239 | mov.l 7f, r9 | 230 | or r8, r9 |
240 | or r9, r8 ! BL =1, RB=1 | 231 | ldc r9, sr |
241 | ldc r8, sr ! here, change the register bank | ||
242 | ! | 232 | ! |
243 | mov.l @r15+, r8 | 233 | mov.l @r15+, r8 |
244 | mov.l @r15+, r9 | 234 | mov.l @r15+, r9 |
@@ -249,12 +239,20 @@ restore_all: | |||
249 | mov.l @r15+, r14 | 239 | mov.l @r15+, r14 |
250 | mov.l @r15+, k4 ! original stack pointer | 240 | mov.l @r15+, k4 ! original stack pointer |
251 | ldc.l @r15+, spc | 241 | ldc.l @r15+, spc |
252 | lds.l @r15+, pr | 242 | mov.l @r15+, k2 ! original PR |
253 | mov.l @r15+, k3 ! original SR | 243 | mov.l @r15+, k3 ! original SR |
254 | ldc.l @r15+, gbr | 244 | ldc.l @r15+, gbr |
255 | lds.l @r15+, mach | 245 | lds.l @r15+, mach |
256 | lds.l @r15+, macl | 246 | lds.l @r15+, macl |
257 | add #4, r15 ! Skip syscall number | 247 | rts |
248 | add #4, r15 ! Skip syscall number | ||
249 | |||
250 | restore_all: | ||
251 | mov.l 7f, r8 | ||
252 | bsr restore_regs | ||
253 | nop | ||
254 | |||
255 | lds k2, pr ! restore pr | ||
258 | ! | 256 | ! |
259 | #ifdef CONFIG_SH_DSP | 257 | #ifdef CONFIG_SH_DSP |
260 | mov.l @r15+, k0 ! DSP mode marker | 258 | mov.l @r15+, k0 ! DSP mode marker |