aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2007-10-03 04:21:10 -0400
committerPaul Mundt <lethal@linux-sh.org>2007-10-03 04:21:10 -0400
commit01bd5e9ef2ead97059a1930de43942bdfc9e8755 (patch)
tree1b2c639a8c2239380929c7f7fe233fdfeecd07bd
parenta90f354709b372c8dcabe3cd6315a83da5927573 (diff)
sh: Make kgdb i-cache flushing less inept.
kgdb had its own ranged I-cache flushing routine that attempted to duplicate the flush_icache_range() functionality, but managed to do an explicit D-cache writeback & invalidate twice on SH-4. This is a no-op for SH-3, and the flush_icache_range() semantics already do what kgdb was feebly attempting to do already, so just move over to that and kill off the wrapper. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r--arch/sh/kernel/kgdb_stub.c8
-rw-r--r--include/asm-sh/kgdb.h12
2 files changed, 4 insertions, 16 deletions
diff --git a/arch/sh/kernel/kgdb_stub.c b/arch/sh/kernel/kgdb_stub.c
index 27f64b92aff0..2fdc700dfd6e 100644
--- a/arch/sh/kernel/kgdb_stub.c
+++ b/arch/sh/kernel/kgdb_stub.c
@@ -609,7 +609,7 @@ static short *get_step_address(void)
609 else 609 else
610 addr = trap_registers.pc + 2; 610 addr = trap_registers.pc + 2;
611 611
612 kgdb_flush_icache_range(addr, addr + 2); 612 flush_icache_range(addr, addr + 2);
613 return (short *) addr; 613 return (short *) addr;
614} 614}
615 615
@@ -632,7 +632,7 @@ static void do_single_step(void)
632 *addr = STEP_OPCODE; 632 *addr = STEP_OPCODE;
633 633
634 /* Flush and return */ 634 /* Flush and return */
635 kgdb_flush_icache_range((long) addr, (long) addr + 2); 635 flush_icache_range((long) addr, (long) addr + 2);
636} 636}
637 637
638/* Undo a single step */ 638/* Undo a single step */
@@ -642,7 +642,7 @@ static void undo_single_step(void)
642 /* Use stepped_address in case we stopped elsewhere */ 642 /* Use stepped_address in case we stopped elsewhere */
643 if (stepped_opcode != 0) { 643 if (stepped_opcode != 0) {
644 *(short*)stepped_address = stepped_opcode; 644 *(short*)stepped_address = stepped_opcode;
645 kgdb_flush_icache_range(stepped_address, stepped_address + 2); 645 flush_icache_range(stepped_address, stepped_address + 2);
646 } 646 }
647 stepped_opcode = 0; 647 stepped_opcode = 0;
648} 648}
@@ -728,7 +728,7 @@ static void write_mem_msg(int binary)
728 ebin_to_mem(ptr, (char*)addr, length); 728 ebin_to_mem(ptr, (char*)addr, length);
729 else 729 else
730 hex_to_mem(ptr, (char*)addr, length); 730 hex_to_mem(ptr, (char*)addr, length);
731 kgdb_flush_icache_range(addr, addr + length); 731 flush_icache_range(addr, addr + length);
732 ptr = 0; 732 ptr = 0;
733 send_ok_msg(); 733 send_ok_msg();
734 } 734 }
diff --git a/include/asm-sh/kgdb.h b/include/asm-sh/kgdb.h
index 5334e86ccad6..4bc8cb187d11 100644
--- a/include/asm-sh/kgdb.h
+++ b/include/asm-sh/kgdb.h
@@ -17,7 +17,6 @@
17#define __KGDB_H 17#define __KGDB_H
18 18
19#include <asm/ptrace.h> 19#include <asm/ptrace.h>
20#include <asm/cacheflush.h>
21 20
22/* Same as pt_regs but has vbr in place of syscall_nr */ 21/* Same as pt_regs but has vbr in place of syscall_nr */
23struct kgdb_regs { 22struct kgdb_regs {
@@ -67,17 +66,6 @@ extern int setjmp(jmp_buf __jmpb);
67/* Forced breakpoint */ 66/* Forced breakpoint */
68#define breakpoint() __asm__ __volatile__("trapa #0x3c") 67#define breakpoint() __asm__ __volatile__("trapa #0x3c")
69 68
70/* KGDB should be able to flush all kernel text space */
71#if defined(CONFIG_CPU_SH4)
72#define kgdb_flush_icache_range(start, end) \
73{ \
74 __flush_purge_region((void*)(start), (int)(end) - (int)(start));\
75 flush_icache_range((start), (end)); \
76}
77#else
78#define kgdb_flush_icache_range(start, end) do { } while (0)
79#endif
80
81/* Taken from sh-stub.c of GDB 4.18 */ 69/* Taken from sh-stub.c of GDB 4.18 */
82static const char hexchars[] = "0123456789abcdef"; 70static const char hexchars[] = "0123456789abcdef";
83 71