Commit 9a4af027 authored by Andre Draszik's avatar Andre Draszik Committed by Paul Mundt

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: default avatarStuart Menefy <stuart.menefy@st.com>
Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent c3144fc4
...@@ -359,13 +359,6 @@ static inline int handle_delayslot(struct pt_regs *regs, ...@@ -359,13 +359,6 @@ static inline int handle_delayslot(struct pt_regs *regs,
#define SH_PC_8BIT_OFFSET(instr) ((((signed char)(instr))*2) + 4) #define SH_PC_8BIT_OFFSET(instr) ((((signed char)(instr))*2) + 4)
#define SH_PC_12BIT_OFFSET(instr) ((((signed short)(instr<<4))>>3) + 4) #define SH_PC_12BIT_OFFSET(instr) ((((signed short)(instr<<4))>>3) + 4)
/*
* XXX: SH-2A needs this too, but it needs an overhaul thanks to mixed 32-bit
* opcodes..
*/
static int handle_unaligned_notify_count = 10;
int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs, int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs,
struct mem_access *ma) struct mem_access *ma)
{ {
...@@ -375,15 +368,13 @@ int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs, ...@@ -375,15 +368,13 @@ int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs,
index = (instruction>>8)&15; /* 0x0F00 */ index = (instruction>>8)&15; /* 0x0F00 */
rm = regs->regs[index]; rm = regs->regs[index];
/* shout about the first ten userspace fixups */ /* shout about fixups */
if (user_mode(regs) && handle_unaligned_notify_count>0) { if (printk_ratelimit())
handle_unaligned_notify_count--; printk(KERN_NOTICE "Fixing up unaligned %s access "
printk(KERN_NOTICE "Fixing up unaligned userspace access "
"in \"%s\" pid=%d pc=0x%p ins=0x%04hx\n", "in \"%s\" pid=%d pc=0x%p ins=0x%04hx\n",
user_mode(regs) ? "userspace" : "kernel",
current->comm, task_pid_nr(current), current->comm, task_pid_nr(current),
(void *)regs->pc, instruction); (void *)regs->pc, instruction);
}
ret = -EFAULT; ret = -EFAULT;
switch (instruction&0xF000) { switch (instruction&0xF000) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment