aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/process.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2007-05-08 02:31:48 -0400
committerPaul Mundt <lethal@hera.kernel.org>2007-05-08 21:35:01 -0400
commit53f983a90d7908bcece51f86180c7c9b575a1e4d (patch)
treeda5914e6f18e8dd55563697de7339af2d99d9c18 /arch/sh/kernel/process.c
parentbd0799977cb9b68aa6a39e9630aeea4778a58385 (diff)
sh: Fix PC adjustments for varying opcode length.
There are a few different cases for figuring out how to size the instruction. We read in the instruction located at regs->pc - 4 when rewinding the opcode to figure out if there's a 32-bit opcode before the faulting instruction, with a default of a - 2 adjustment on a mismatch. In practice this works for the cases where pc - 4 is just another 16-bit opcode, or we happen to have a 32-bit and a 16-bit immediately preceeding the pc value. In the cases where we aren't rewinding, this is much less ugly.. We also don't bother fixing up the places where we're explicitly dealing with 16-bit instructions, since this might lead to confusion regarding the encoding size possibilities on other CPU variants. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/kernel/process.c')
-rw-r--r--arch/sh/kernel/process.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c
index 209cc9b4218..9005b2f12aa 100644
--- a/arch/sh/kernel/process.c
+++ b/arch/sh/kernel/process.c
@@ -498,7 +498,7 @@ asmlinkage void debug_trap_handler(unsigned long r4, unsigned long r5,
498 struct pt_regs *regs = RELOC_HIDE(&__regs, 0); 498 struct pt_regs *regs = RELOC_HIDE(&__regs, 0);
499 499
500 /* Rewind */ 500 /* Rewind */
501 regs->pc -= instruction_size(regs->pc); 501 regs->pc -= instruction_size(ctrl_inw(regs->pc - 4));
502 502
503 if (notify_die(DIE_TRAP, regs, regs->tra & 0xff, 503 if (notify_die(DIE_TRAP, regs, regs->tra & 0xff,
504 SIGTRAP) == NOTIFY_STOP) 504 SIGTRAP) == NOTIFY_STOP)
@@ -517,7 +517,7 @@ asmlinkage void bug_trap_handler(unsigned long r4, unsigned long r5,
517 struct pt_regs *regs = RELOC_HIDE(&__regs, 0); 517 struct pt_regs *regs = RELOC_HIDE(&__regs, 0);
518 518
519 /* Rewind */ 519 /* Rewind */
520 regs->pc -= instruction_size(regs->pc); 520 regs->pc -= instruction_size(ctrl_inw(regs->pc - 4));
521 521
522 if (notify_die(DIE_TRAP, regs, TRAPA_BUG_OPCODE & 0xff, 522 if (notify_die(DIE_TRAP, regs, TRAPA_BUG_OPCODE & 0xff,
523 SIGTRAP) == NOTIFY_STOP) 523 SIGTRAP) == NOTIFY_STOP)