aboutsummaryrefslogtreecommitdiff
path: root/arch/sh/kernel/traps_32.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-09-25 07:44:14 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-25 07:44:14 -0700
commit53cddfcc0e760d2b364878b6dadbd0c6d087cfae (patch)
tree3f2471b2452467b50c80cd61b12f708b2df39e0e /arch/sh/kernel/traps_32.c
parentc09c2d1089b55a3da7058a2f1a76c2f21c8b0688 (diff)
parenta79aebfca1e597c1aab4b8e327028f96f5ea9095 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6: sh_mobile_ceu_camera: fix compile breakage, caused by a bad merge sh: Add support DMA Engine to SH7780 sh: Add support DMA Engine to SH7722 sh: enable onenand support in kfr2r09 defconfig. sh: update defconfigs. sh: add FSI driver support for ms7724se sh: Fix up uninitialized variable use caught by gcc 4.4. sh: Handle unaligned 16-bit instructions on SH-2A. sh: mach-ecovec24: Add active low setting for sh_eth sh: includecheck fix: dwarf.c
Diffstat (limited to 'arch/sh/kernel/traps_32.c')
-rw-r--r--arch/sh/kernel/traps_32.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/arch/sh/kernel/traps_32.c b/arch/sh/kernel/traps_32.c
index 6aba9af79ea..69bb1652ecc 100644
--- a/arch/sh/kernel/traps_32.c
+++ b/arch/sh/kernel/traps_32.c
@@ -452,6 +452,12 @@ int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs,
u_int rm;
int ret, index;
+ /*
+ * XXX: We can't handle mixed 16/32-bit instructions yet
+ */
+ if (instruction_size(instruction) != 2)
+ return -EINVAL;
+
index = (instruction>>8)&15; /* 0x0F00 */
rm = regs->regs[index];
@@ -619,9 +625,9 @@ asmlinkage void do_address_error(struct pt_regs *regs,
se_user += 1;
-#ifndef CONFIG_CPU_SH2A
set_fs(USER_DS);
- if (copy_from_user(&instruction, (u16 *)(regs->pc & ~1), 2)) {
+ if (copy_from_user(&instruction, (insn_size_t *)(regs->pc & ~1),
+ sizeof(instruction))) {
set_fs(oldfs);
goto uspace_segv;
}
@@ -633,7 +639,6 @@ asmlinkage void do_address_error(struct pt_regs *regs,
"in \"%s\" pid=%d pc=0x%p ins=0x%04hx\n",
current->comm, current->pid, (void *)regs->pc,
instruction);
-#endif
if (se_usermode & 2)
goto fixup;
@@ -673,12 +678,6 @@ uspace_segv:
} else {
se_sys += 1;
- if (se_kernmode_warn)
- printk(KERN_NOTICE "Unaligned kernel access "
- "on behalf of \"%s\" pid=%d pc=0x%p ins=0x%04hx\n",
- current->comm, current->pid, (void *)regs->pc,
- instruction);
-
if (regs->pc & 1)
die("unaligned program counter", regs, error_code);
@@ -692,6 +691,12 @@ uspace_segv:
die("insn faulting in do_address_error", regs, 0);
}
+ if (se_kernmode_warn)
+ printk(KERN_NOTICE "Unaligned kernel access "
+ "on behalf of \"%s\" pid=%d pc=0x%p ins=0x%04hx\n",
+ current->comm, current->pid, (void *)regs->pc,
+ instruction);
+
handle_unaligned_access(instruction, regs,
&user_mem_access, 0);
set_fs(oldfs);