Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 120116
b: refs/heads/master
c: ab6e570
h: refs/heads/master
v: v3
  • Loading branch information
Paul Mundt committed Dec 22, 2008
1 parent 6eecfd6 commit 6881104
Show file tree
Hide file tree
Showing 16 changed files with 329 additions and 1,245 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d7b01f78a3ae6a3cc21a16a1a3d377adc2227537
refs/heads/master: ab6e570ba33dbee18c2520d386e0f367a9b573c3
1 change: 1 addition & 0 deletions trunk/arch/sh/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ config SUPERH32
select HAVE_FUNCTION_TRACER
select HAVE_FTRACE_MCOUNT_RECORD
select HAVE_DYNAMIC_FTRACE
select HAVE_ARCH_KGDB

config SUPERH64
def_bool y if CPU_SH5
Expand Down
69 changes: 0 additions & 69 deletions trunk/arch/sh/Kconfig.debug
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,6 @@ config IRQSTACKS
for handling hard and soft interrupts. This can help avoid
overflowing the process kernel stacks.

config SH_KGDB
bool "Include KGDB kernel debugger"
select FRAME_POINTER
select DEBUG_INFO
depends on CPU_SH3 || CPU_SH4
help
Include in-kernel hooks for kgdb, the Linux kernel source level
debugger. See <http://kgdb.sourceforge.net/> for more information.
Unless you are intending to debug the kernel, say N here.

menu "KGDB configuration options"
depends on SH_KGDB

config MORE_COMPILE_OPTIONS
bool "Add any additional compile options"
help
Expand All @@ -122,62 +109,6 @@ config COMPILE_OPTIONS
string "Additional compile arguments"
depends on MORE_COMPILE_OPTIONS

config KGDB_NMI
def_bool n
prompt "Enter KGDB on NMI"

config SH_KGDB_CONSOLE
def_bool n
prompt "Console messages through GDB"
depends on !SERIAL_SH_SCI_CONSOLE && SERIAL_SH_SCI=y
select SERIAL_CORE_CONSOLE

config KGDB_SYSRQ
def_bool y
prompt "Allow SysRq 'G' to enter KGDB"
depends on MAGIC_SYSRQ

comment "Serial port setup"

config KGDB_DEFPORT
int "Port number (ttySCn)"
default "1"

config KGDB_DEFBAUD
int "Baud rate"
default "115200"

choice
prompt "Parity"
depends on SH_KGDB
default KGDB_DEFPARITY_N

config KGDB_DEFPARITY_N
bool "None"

config KGDB_DEFPARITY_E
bool "Even"

config KGDB_DEFPARITY_O
bool "Odd"

endchoice

choice
prompt "Data bits"
depends on SH_KGDB
default KGDB_DEFBITS_8

config KGDB_DEFBITS_8
bool "8"

config KGDB_DEFBITS_7
bool "7"

endchoice

endmenu

if SUPERH64

config SH64_SR_WATCH
Expand Down
66 changes: 19 additions & 47 deletions trunk/arch/sh/include/asm/kgdb.h
Original file line number Diff line number Diff line change
@@ -1,21 +1,7 @@
/*
* May be copied or modified under the terms of the GNU General Public
* License. See linux/COPYING for more information.
*
* Based on original code by Glenn Engel, Jim Kingdon,
* David Grothe <dave@gcom.com>, Tigran Aivazian, <tigran@sco.com> and
* Amit S. Kale <akale@veritas.com>
*
* Super-H port based on sh-stub.c (Ben Lee and Steve Chamberlain) by
* Henry Bell <henry.bell@st.com>
*
* Header file for low-level support for remote debug using GDB.
*
*/

#ifndef __KGDB_H
#define __KGDB_H
#ifndef __ASM_SH_KGDB_H
#define __ASM_SH_KGDB_H

#include <asm/cacheflush.h>
#include <asm/ptrace.h>

/* Same as pt_regs but has vbr in place of syscall_nr */
Expand All @@ -30,40 +16,26 @@ struct kgdb_regs {
unsigned long vbr;
};

/* State info */
extern char kgdb_in_gdb_mode;
extern int kgdb_nofault; /* Ignore bus errors (in gdb mem access) */
extern char in_nmi; /* Debounce flag to prevent NMI reentry*/
enum regnames {
GDB_R0, GDB_R1, GDB_R2, GDB_R3, GDB_R4, GDB_R5, GDB_R6, GDB_R7,
GDB_R8, GDB_R9, GDB_R10, GDB_R11, GDB_R12, GDB_R13, GDB_R14, GDB_R15,

/* SCI */
extern int kgdb_portnum;
extern int kgdb_baud;
extern char kgdb_parity;
extern char kgdb_bits;
GDB_PC, GDB_PR, GDB_SR, GDB_GBR, GDB_MACH, GDB_MACL, GDB_VBR,
};

/* Init and interface stuff */
extern int kgdb_init(void);
extern int (*kgdb_getchar)(void);
extern void (*kgdb_putchar)(int);
#define NUMREGBYTES ((GDB_VBR + 1) * 4)

/* Trap functions */
typedef void (kgdb_debug_hook_t)(struct pt_regs *regs);
typedef void (kgdb_bus_error_hook_t)(void);
extern kgdb_debug_hook_t *kgdb_debug_hook;
extern kgdb_bus_error_hook_t *kgdb_bus_err_hook;
static inline void arch_kgdb_breakpoint(void)
{
__asm__ __volatile__ ("trapa #0x3c\n");
}

/* Console */
struct console;
void kgdb_console_write(struct console *co, const char *s, unsigned count);
extern int kgdb_console_setup(struct console *, char *);
/* State info */
extern char in_nmi; /* Debounce flag to prevent NMI reentry*/

/* Prototypes for jmp fns */
#define _JBLEN 9
typedef int jmp_buf[_JBLEN];
extern void longjmp(jmp_buf __jmpb, int __retval);
extern int setjmp(jmp_buf __jmpb);
#define BUFMAX 2048

/* Forced breakpoint */
#define breakpoint() __asm__ __volatile__("trapa #0x3c")
#define CACHE_FLUSH_IS_SAFE 1
#define BREAK_INSTR_SIZE 2

#endif
#endif /* __ASM_SH_KGDB_H */
2 changes: 2 additions & 0 deletions trunk/arch/sh/include/asm/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ asmlinkage void name##_trap_handler(unsigned int vec, struct pt_regs *regs)
BUILD_TRAP_HANDLER(address_error);
BUILD_TRAP_HANDLER(debug);
BUILD_TRAP_HANDLER(bug);
BUILD_TRAP_HANDLER(breakpoint);
BUILD_TRAP_HANDLER(singlestep);
BUILD_TRAP_HANDLER(fpu_error);
BUILD_TRAP_HANDLER(fpu_state_restore);

Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/sh/kernel/Makefile_32
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ obj-$(CONFIG_VSYSCALL) += vsyscall/
obj-$(CONFIG_SMP) += smp.o
obj-$(CONFIG_CF_ENABLER) += cf-enabler.o
obj-$(CONFIG_SH_STANDARD_BIOS) += sh_bios.o
obj-$(CONFIG_SH_KGDB) += kgdb_stub.o kgdb_jmp.o
obj-$(CONFIG_KGDB) += kgdb.o
obj-$(CONFIG_SH_CPU_FREQ) += cpufreq.o
obj-$(CONFIG_MODULES) += sh_ksyms_32.o module.o
obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
Expand Down
10 changes: 5 additions & 5 deletions trunk/arch/sh/kernel/cpu/sh3/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
* syscall #
*
*/
#if defined(CONFIG_KGDB_NMI)
#if defined(CONFIG_KGDB)
NMI_VEC = 0x1c0 ! Must catch early for debounce
#endif

Expand Down Expand Up @@ -307,7 +307,7 @@ skip_restore:
6: or k0, k2 ! Set the IMASK-bits
ldc k2, ssr
!
#if defined(CONFIG_KGDB_NMI)
#if defined(CONFIG_KGDB)
! Clear in_nmi
mov.l 6f, k0
mov #0, k1
Expand All @@ -320,7 +320,7 @@ skip_restore:

.align 2
5: .long 0x00001000 ! DSP
#ifdef CONFIG_KGDB_NMI
#ifdef CONFIG_KGDB
6: .long in_nmi
#endif
7: .long 0x30000000
Expand Down Expand Up @@ -377,7 +377,7 @@ tlb_miss:
.balign 512,0,512
interrupt:
mov.l 3f, k3
#if defined(CONFIG_KGDB_NMI)
#if defined(CONFIG_KGDB)
mov.l 2f, k2
! Debounce (filter nested NMI)
mov.l @k2, k0
Expand All @@ -394,7 +394,7 @@ interrupt:
5: .long NMI_VEC
6: .long in_nmi
0:
#endif /* defined(CONFIG_KGDB_NMI) */
#endif /* defined(CONFIG_KGDB) */
bra handle_exception
mov #-1, k2 ! interrupt exception marker

Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/sh/kernel/cpu/sh3/ex.S
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#define fpu_error_trap_handler exception_error
#endif

#if !defined(CONFIG_KGDB_NMI)
#if !defined(CONFIG_KGDB)
#define kgdb_handle_exception exception_error
#endif

Expand Down
13 changes: 7 additions & 6 deletions trunk/arch/sh/kernel/debugtraps.S
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* Debug trap jump tables for SuperH
*
* Copyright (C) 2006 Paul Mundt
* Copyright (C) 2006 - 2008 Paul Mundt
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
Expand All @@ -12,12 +12,13 @@
#include <linux/sys.h>
#include <linux/linkage.h>

#if !defined(CONFIG_SH_KGDB)
#define kgdb_handle_exception debug_trap_handler
#if !defined(CONFIG_KGDB)
#define breakpoint_trap_handler debug_trap_handler
#define singlestep_trap_handler debug_trap_handler
#endif

#if !defined(CONFIG_SH_STANDARD_BIOS)
#define sh_bios_handler debug_trap_handler
#define sh_bios_handler debug_trap_handler
#endif

.data
Expand All @@ -35,7 +36,7 @@ ENTRY(debug_trap_table)
.long debug_trap_handler /* 0x39 */
.long debug_trap_handler /* 0x3a */
.long debug_trap_handler /* 0x3b */
.long kgdb_handle_exception /* 0x3c */
.long debug_trap_handler /* 0x3d */
.long breakpoint_trap_handler /* 0x3c */
.long singlestep_trap_handler /* 0x3d */
.long bug_trap_handler /* 0x3e */
.long sh_bios_handler /* 0x3f */
10 changes: 7 additions & 3 deletions trunk/arch/sh/kernel/entry-common.S
Original file line number Diff line number Diff line change
Expand Up @@ -308,15 +308,19 @@ ENTRY(system_call)
mov.l 1f, r9
mov.l @r9, r8 ! Read from TRA (Trap Address) Register
#endif

mov #OFF_TRA, r10
add r15, r10
mov.l r8, @r10 ! set TRA value to tra

/*
* Check the trap type
*/
mov #((0x20 << 2) - 1), r9
cmp/hi r9, r8
bt/s debug_trap ! it's a debug trap..
mov #OFF_TRA, r9
add r15, r9
mov.l r8, @r9 ! set TRA value to tra
nop

#ifdef CONFIG_TRACE_IRQFLAGS
mov.l 5f, r10
jsr @r10
Expand Down
Loading

0 comments on commit 6881104

Please sign in to comment.