浏览代码

sh: Only shout about fixing up unexpected unaligned accesses

Some unaligned accesses are completely expected. For example, the
trapped_io code uses the unaligned access fixup code path so there's no
need to warn about having to fixup the unaligned access.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Matt Fleming 15 年之前
父节点
当前提交
4aa5ac4ef4
共有 3 个文件被更改,包括 8 次插入6 次删除
  1. 1 1
      arch/sh/include/asm/system_32.h
  2. 2 1
      arch/sh/kernel/io_trapped.c
  3. 5 4
      arch/sh/kernel/traps_32.c

+ 1 - 1
arch/sh/include/asm/system_32.h

@@ -199,7 +199,7 @@ do {							\
 #endif
 #endif
 
 
 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, int);
 
 
 asmlinkage void do_address_error(struct pt_regs *regs,
 asmlinkage void do_address_error(struct pt_regs *regs,
 				 unsigned long writeaccess,
 				 unsigned long writeaccess,

+ 2 - 1
arch/sh/kernel/io_trapped.c

@@ -284,7 +284,8 @@ int handle_trapped_io(struct pt_regs *regs, unsigned long address)
 		return 0;
 		return 0;
 	}
 	}
 
 
-	tmp = handle_unaligned_access(instruction, regs, &trapped_io_access);
+	tmp = handle_unaligned_access(instruction, regs,
+				      &trapped_io_access, 1);
 	set_fs(oldfs);
 	set_fs(oldfs);
 	return tmp == 0;
 	return tmp == 0;
 }
 }

+ 5 - 4
arch/sh/kernel/traps_32.c

@@ -449,7 +449,7 @@ static inline int handle_delayslot(struct pt_regs *regs,
 #define SH_PC_12BIT_OFFSET(instr) ((((signed short)(instr<<4))>>3) + 4)
 #define SH_PC_12BIT_OFFSET(instr) ((((signed short)(instr<<4))>>3) + 4)
 
 
 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, int expected)
 {
 {
 	u_int rm;
 	u_int rm;
 	int ret, index;
 	int ret, index;
@@ -458,7 +458,7 @@ int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs,
 	rm = regs->regs[index];
 	rm = regs->regs[index];
 
 
 	/* shout about fixups */
 	/* shout about fixups */
-	if (printk_ratelimit())
+	if (!expected && printk_ratelimit())
 		printk(KERN_NOTICE "Fixing up unaligned %s access "
 		printk(KERN_NOTICE "Fixing up unaligned %s 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",
 		       user_mode(regs) ? "userspace" : "kernel",
@@ -657,7 +657,7 @@ fixup:
 
 
 		set_fs(USER_DS);
 		set_fs(USER_DS);
 		tmp = handle_unaligned_access(instruction, regs,
 		tmp = handle_unaligned_access(instruction, regs,
-					      &user_mem_access);
+					      &user_mem_access, 0);
 		set_fs(oldfs);
 		set_fs(oldfs);
 
 
 		if (tmp==0)
 		if (tmp==0)
@@ -694,7 +694,8 @@ uspace_segv:
 			die("insn faulting in do_address_error", regs, 0);
 			die("insn faulting in do_address_error", regs, 0);
 		}
 		}
 
 
-		handle_unaligned_access(instruction, regs, &user_mem_access);
+		handle_unaligned_access(instruction, regs,
+					&user_mem_access, 0);
 		set_fs(oldfs);
 		set_fs(oldfs);
 	}
 	}
 }
 }