KGDB: This is support of the IA64 arch for KGDB
PATCH 10/21 KGDB: This is support of the IA64 arch for KGDB
Signed-off-by Jason Wessel <[email protected]>
ia64-lite.patch
From: Jason Wessel <[email protected]>
CC: [email protected]
Subject: [PATCH] This is support of the IA64 arch for KGDB
Bob Picco is the primary contributor and maintainer of the IA64 KGDB arch.
This patch adds the unified kgdb support for the ia64 arch.
Signed-off-by Milind Dumbare <[email protected]>
Signed-off-by Bob Picco <[email protected]>
--- arch/ia64/kernel/Makefile | 1 arch/ia64/kernel/kgdb-jmp.S | 240 +++++++++++ arch/ia64/kernel/kgdb.c | 942 ++++++++++++++++++++++++++++++++++++++++++++ arch/ia64/kernel/smp.c | 17 arch/ia64/kernel/traps.c | 6 arch/ia64/mm/extable.c | 6 arch/ia64/mm/fault.c | 4 include/asm-ia64/kdebug.h | 1 include/asm-ia64/kgdb.h | 36 + lib/Kconfig.kgdb | 2 10 files changed, 1253 insertions(+), 2 deletions(-) create mode 100644 arch/ia64/kernel/kgdb-jmp.S create mode 100644 arch/ia64/kernel/kgdb.c create mode 100644 include/asm-ia64/kgdb.h
arch/ia64/kernel/Makefile +1 -0
@@ -35,6 +35,7 @@ obj-$(CONFIG_AUDIT) += audit.o obj-$(CONFIG_PCI_MSI) += msi_ia64.o mca_recovery-y += mca_drv.o mca_drv_asm.o obj-$(CONFIG_IA64_MC_ERR_INJECT)+= err_inject.o +obj-$(CONFIG_KGDB) += kgdb.o kgdb-jmp.o obj-$(CONFIG_IA64_ESI) += esi.o ifneq ($(CONFIG_IA64_ESI),)
arch/ia64/kernel/kgdb-jmp.S new file +240 -0
240 lines not on this page · raw message
arch/ia64/kernel/kgdb.c new file +942 -0
942 lines not on this page · raw message
arch/ia64/kernel/smp.c +17 -0
@@ -48,6 +48,7 @@#include <asm/tlbflush.h> #include <asm/unistd.h> #include <asm/mca.h> +#include <linux/kgdb.h> /* * Note: alignment of 4 entries/cacheline was empirically determined
@@ -79,6 +80,9 @@ static volatile struct call_data_struct#define IPI_CALL_FUNC 0#define IPI_CPU_STOP 1 +#ifdef CONFIG_KGDB +#define IPI_KGDB_INTERRUPT 2 +#endif #define IPI_KDUMP_CPU_STOP 3/* This needs to be cacheline aligned because it is written to by *other* CPUs. */
@@ -169,6 +173,11 @@ handle_IPI (int irq, void *dev_id)case IPI_CPU_STOP :stop_this_cpu ();break ; +#ifdef CONFIG_KGDB +case IPI_KGDB_INTERRUPT : +kgdb_wait_ipi (get_irq_regs ()); +break ; +#endif #ifdef CONFIG_KEXEC case IPI_KDUMP_CPU_STOP :unw_init_running (kdump_cpu_freeze,NULL );
@@ -401,6 +410,14 @@ smp_call_function_single (int cpuid, voi }EXPORT_SYMBOL (smp_call_function_single); +#ifdef CONFIG_KGDB +void +smp_send_nmi_allbutself (void ) +{ +send_IPI_allbutself (IPI_KGDB_INTERRUPT ); +} +#endif +/* * this function sends a 'generic call function' IPI to all other CPUs * in the system.
arch/ia64/kernel/traps.c +5 -1
@@ -155,8 +155,12 @@ __kprobes ia64_bad_break (unsigned longbreak ;default : -if (break_num <0x40000 || break_num >0x100000 ) +if (break_num <0x40000 || break_num >0x100000 ) { +if (notify_die (DIE_BREAK ,"bad break" , regs, + break_num,TRAP_BRKPT ,SIGTRAP ) ==NOTIFY_STOP ) +return ;die_if_kernel ("Bad break" , regs, break_num); + }if (break_num <0x80000 ) { sig =SIGILL ; code = __ILL_BREAK;
arch/ia64/mm/extable.c +6 -0
@@ -6,6 +6,7 @@*/ #include <linux/sort.h> +#include <linux/kgdb.h> #include <asm/uaccess.h> #include <asm/module.h>
@@ -73,6 +74,11 @@ search_extable (const struct exception_telse last = mid -1 ; } +#ifdef CONFIG_KGDB +if (atomic_read (&debugger_active) && kgdb_may_fault) +kgdb_fault_longjmp (kgdb_fault_jmp_regs); +/* Not reached. */ +#endif return NULL ; }
arch/ia64/mm/fault.c +4 -0
@@ -262,6 +262,10 @@ ia64_do_page_fault (unsigned long addres*/ bust_spinlocks (1 ); +if (notify_die (DIE_PAGE_FAULT_NO_CONTEXT ,"no context" , regs, + isr,14 ,SIGSEGV ) ==NOTIFY_STOP ) +return ; +if (address <PAGE_SIZE )printk (KERN_ALERT "Unable to handle kernel NULL pointer dereference (address %016lx)\n" , address);else
include/asm-ia64/kdebug.h +1 -0
@@ -69,6 +69,7 @@ enum die_val {DIE_KDEBUG_LEAVE ,DIE_KDUMP_ENTER ,DIE_KDUMP_LEAVE , + DIE_PAGE_FAULT_NO_CONTEXT, };#endif
include/asm-ia64/kgdb.h new file +36 -0
@@ -0,0 +1,36 @@ +#ifdef __KERNEL__ +#ifndef _ASM_KGDB_H_ +#define _ASM_KGDB_H_ + +/* +* Copyright (C) 2001-2004 Amit S. Kale +*/ + +#include <linux/threads.h> +#include <asm-generic/kgdb.h> + +/************************************************************************/ +/* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/ +/* at least NUMREGBYTES*2 are needed for register packets */ +/* Longer buffer is needed to list all threads */ +#define BUFMAX 1024 + +/* Number of bytes of registers. We set this to 0 so that certain GDB +* packets will fail, forcing the use of others, which are more friendly +* on ia64. */ +#define NUMREGBYTES 0 + +#define NUMCRITREGBYTES (70*8) +#define JMP_REGS_ALIGNMENT __attribute__ ((aligned (16))) + +#define BREAKNUM 0x00003333300LL +#define KGDBBREAKNUM 0x6665UL +#define BREAKPOINT () asm volatile ("break.m 0x6665") +#define BREAK_INSTR_SIZE 16 +#define CACHE_FLUSH_IS_SAFE 1 + +struct pt_regs ; +extern void smp_send_nmi_allbutself (void ); +extern void kgdb_wait_ipi (struct pt_regs *); +#endif /* _ASM_KGDB_H_ */ +#endif /* __KERNEL__ */
lib/Kconfig.kgdb +1 -1
@@ -13,7 +13,7 @@ config UNWIND_INFO config KGDB bool "KGDB: kernel debugging with remote gdb" select WANT_EXTRA_DEBUG_INFORMATION - depends on DEBUG_KERNEL && (X86 || MIPS || PPC) + depends on DEBUG_KERNEL && (X86 || MIPS || IA64 || PPC) help If you say Y here, it will be possible to remotely debug the kernel using gdb. Documentation of kernel debugger is available