aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh
diff options
context:
space:
mode:
authorAndre Draszik <andre.draszik@st.com>2009-08-24 01:38:27 -0400
committerPaul Mundt <lethal@linux-sh.org>2009-08-24 01:38:27 -0400
commit9a4af027a03e10e97f56081cd7dd1fda5282bd9c (patch)
treedb1c974bc46f8781c877fc6382b3113ff53a67d8 /arch/sh
parentc3144fc46f987413df10e83659f0bf1aad76f79e (diff)
sh: ratelimit unaligned fixups
This patch makes sure we see messages about unaligned access fixups every now and then. Else especially userspace apps suffering from bad programming won't ever be noticed... Signed-off by: Andre Draszik <andre.draszik@st.com> 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/kernel/traps_32.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/arch/sh/kernel/traps_32.c b/arch/sh/kernel/traps_32.c
index 05a04b6df84..866c7c7a823 100644
--- a/arch/sh/kernel/traps_32.c
+++ b/arch/sh/kernel/traps_32.c
@@ -359,13 +359,6 @@ static inline int handle_delayslot(struct pt_regs *regs,
359#define SH_PC_8BIT_OFFSET(instr) ((((signed char)(instr))*2) + 4) 359#define SH_PC_8BIT_OFFSET(instr) ((((signed char)(instr))*2) + 4)
360#define SH_PC_12BIT_OFFSET(instr) ((((signed short)(instr<<4))>>3) + 4) 360#define SH_PC_12BIT_OFFSET(instr) ((((signed short)(instr<<4))>>3) + 4)
361 361
362/*
363 * XXX: SH-2A needs this too, but it needs an overhaul thanks to mixed 32-bit
364 * opcodes..
365 */
366
367static int handle_unaligned_notify_count = 10;
368
369int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs, 362int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs,
370 struct mem_access *ma) 363 struct mem_access *ma)
371{ 364{
@@ -375,15 +368,13 @@ int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs,
375 index = (instruction>>8)&15; /* 0x0F00 */ 368 index = (instruction>>8)&15; /* 0x0F00 */
376 rm = regs->regs[index]; 369 rm = regs->regs[index];
377 370
378 /* shout about the first ten userspace fixups */ 371 /* shout about fixups */
379 if (user_mode(regs) && handle_unaligned_notify_count>0) { 372 if (printk_ratelimit())
380 handle_unaligned_notify_count--; 373 printk(KERN_NOTICE "Fixing up unaligned %s access "
381
382 printk(KERN_NOTICE "Fixing up unaligned userspace access "
383 "in \"%s\" pid=%d pc=0x%p ins=0x%04hx\n", 374 "in \"%s\" pid=%d pc=0x%p ins=0x%04hx\n",
375 user_mode(regs) ? "userspace" : "kernel",
384 current->comm, task_pid_nr(current), 376 current->comm, task_pid_nr(current),
385 (void *)regs->pc, instruction); 377 (void *)regs->pc, instruction);
386 }
387 378
388 ret = -EFAULT; 379 ret = -EFAULT;
389 switch (instruction&0xF000) { 380 switch (instruction&0xF000) {