MN10300: Fix one of the kernel debugger cacheflush variants
PATCH 1/3 MN10300: Fix one of the kernel debugger cacheflush variants
One of the kernel debugger cacheflush variants escaped proper testing. Two of the labels are wrong, being derived from the code that was copied to construct the variant.
The first label results in the following assembler message:
AS arch/mn10300/mm/cache-dbg-flush-by-reg.oarch/mn10300/mm/cache-dbg-flush-by-reg.S: Assembler messages:arch/mn10300/mm/cache-dbg-flush-by-reg.S:123: Error: symbol `debugger_local_cache_flushinv_no_dcache' is already defined
And the second label results in the following linker message:
arch/mn10300/mm/built-in.o:(.text+0x1d39): undefined reference to mn10300_local_icache_inv_range_reg_end' arch/mn10300/mm/built-in.o:(.text+0x1d39): relocation truncated to fit: R_MN10300_PCREL16 against undefined symbol mn10300_local_icache_inv_range_reg_end'
To test this file the following configuration pieces must be set:
CONFIG_AM34=y CONFIG_MN10300_CACHE_WBACK=y CONFIG_MN10300_DEBUGGER_CACHE_FLUSH_BY_REG=y CONFIG_MN10300_CACHE_MANAGE_BY_REG=y CONFIG_AM34_HAS_CACHE_SNOOP=n
---
arch/mn10300/mm/cache-dbg-flush-by-reg.S | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/mn10300/mm/cache-dbg-flush-by-reg.S +2 -2
@@ -120,14 +120,14 @@ debugger_local_cache_flushinv_one: # conditionally purge this line in all ways mov d1,(L1_CACHE_WAYDISP*0,a0) -debugger_local_cache_flushinv_no_dcache: +debugger_local_cache_flushinv_one_no_dcache: # # now try to flush the icache # mov CHCTR,a0 movhu (a0),d0 btst CHCTR_ICEN,d0 - beq mn10300_local_icache_inv_range_reg_end + beq debugger_local_cache_flushinv_one_end LOCAL_CLI_SAVE(d1)
PATCH 2/3 MN10300: die_if_no_fixup() shouldn't use get_user() as it doesn't call set_fs()
die_if_no_fixup() shouldn't use get_user() as it doesn't call set_fs() to indicate that it wants to probe a kernel address. Instead it should use probe_kernel_read().
This fixes the problem of gdb seeing SIGILL rather than SIGTRAP when hitting the KGDB special breakpoint upon SysRq+g being seen. The problem was that die_if_no_fixup() was failing to read the opcode of the instruction that caused the exception, and thus not fixing up the exception.
This caused gdb to get a S04 response to the $? request in its remote protocol rather than S05 - which would then cause it to continue with $C04 rather than $c in an attempt to pass the signal onto the inferior process. The kernel, however, does not support $Cnn, and so objects by returning an E22 response, indicating an error. gdb does not expect this and prints:
warning: Remote failure reply: E22
and then returns to the gdb command prompt unable to continue.
---
arch/mn10300/kernel/traps.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/mn10300/kernel/traps.c +2 -2
@@ -28,7 +28,7 @@#include <linux/irq.h> #include <asm/processor.h> #include <asm/system.h> -#include <asm/uaccess.h> +#include <linux/uaccess.h> #include <asm/io.h> #include <asm/atomic.h> #include <asm/smp.h>
@@ -156,7 +156,7 @@ int die_if_no_fixup(const char *str, struct pt_regs *regs,case EXCEP_TRAP :case EXCEP_UNIMPINS : -if (get_user (opcode, (uint8_t __user *)regs->pc) !=0 ) +if (probe_kernel_read (&opcode, (u8 *)regs->pc,1 ) <0 )break ;if (opcode ==0xff ) {if (notify_die (DIE_BREAKPOINT , str, regs, code,0 ,0 ))
PATCH 3/3 MN10300: Add missing _sdata declaration
In reply to David Howells_sdata needs to be declared in the linker script now as of:
commit a2d063ac216c1618bfc2b4d40b7176adffa63511 Author: Steven Rostedt <[email protected]> Date: Thu May 19 21:34:58 2011 -0400 extable, core_kernel_data(): Make sure all archs define _sdata
---
arch/mn10300/kernel/vmlinux.lds.S | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
arch/mn10300/kernel/vmlinux.lds.S +1 -0
@@ -44,6 +44,7 @@ SECTIONS RO_DATA(PAGE_SIZE) /* writeable */ + _sdata = .; /* Start of rw data section */ RW_DATA_SECTION(32, PAGE_SIZE, THREAD_SIZE) _edata = .;