KGDB: This adds support for the x86_64 architecture.
Subsystems (2)
PATCH 12/21 KGDB: This adds support for the x86_64 architecture.
Signed-off-by Jason Wessel <[email protected]>
x86_64-lite.patch
From: Jason Wessel <[email protected]>
CC: [email protected]
Subject: [PATCH] This adds support for the x86_64 architecture.
An extra annotation is added to the switch_to in order to aid in stack tracing from gdb or other external hardware debuggers.
Signed-off-by Milind Dumbare <[email protected]>
Signed-off-by Tom Rini <[email protected]>
Signed-off-by Jason Wessel <[email protected]>
--- arch/x86/kernel/Makefile_64 | 1 arch/x86/kernel/kgdb-jmp_64.S | 65 +++++++ arch/x86/kernel/kgdb_64.c | 384 ++++++++++++++++++++++++++++++++++++++++++ arch/x86/kernel/traps_64.c | 7 arch/x86_64/Kconfig.debug | 3 include/asm-x86/kgdb_64.h | 52 +++++ include/asm-x86/system_64.h | 6 lib/Kconfig.kgdb | 1 8 files changed, 514 insertions(+), 5 deletions(-) create mode 100644 arch/x86/kernel/kgdb-jmp.S create mode 100644 arch/x86/kernel/kgdb.c create mode 100644 include/asm-x86/kgdb.h
arch/x86_64/Kconfig.debug +0 -3
@@ -55,7 +55,4 @@ config DEBUG_STACK_USAGE This option will slow down process creation somewhat. -#config X86_REMOTE_DEBUG -# bool "kgdb debugging stub" - endmenu
arch/x86/kernel/Makefile_64 +1 -0
@@ -33,6 +33,7 @@ obj-$(CONFIG_IOMMU) += pci-gart_64.o ap obj-$(CONFIG_CALGARY_IOMMU) += pci-calgary_64.o tce_64.o obj-$(CONFIG_SWIOTLB) += pci-swiotlb_64.o obj-$(CONFIG_KPROBES) += kprobes_64.o +obj-$(CONFIG_KGDB) += kgdb_64.o kgdb-jmp_64.o obj-$(CONFIG_X86_PM_TIMER) += pmtimer_64.o obj-$(CONFIG_X86_VSMP) += vsmp_64.o obj-$(CONFIG_K8_NB) += k8.o
arch/x86/kernel/kgdb-jmp_64.S new file +65 -0
65 lines not on this page · raw message
arch/x86/kernel/kgdb_64.c new file +384 -0
384 lines not on this page · raw message
include/asm-x86/kgdb_64.h new file +52 -0
52 lines not on this page · raw message
include/asm-x86/system_64.h +5 -1
@@ -22,7 +22,9 @@/* Save restore flags to clear handle leaking NT */ #define switch_to (prev,next,last) \ - asm volatile(SAVE_CONTEXT \ + asm volatile(".globl __switch_to_begin\n\t" \ + "__switch_to_begin:\n\t" \ + SAVE_CONTEXT \ "movq %%rsp,%P[threadrsp](%[prev])\n\t"/* save RSP */ \"movq %P[threadrsp](%[next]),%%rsp\n\t" /* restore RSP */ \"call __switch_to\n\t" \
@@ -34,6 +36,8 @@ "movq %%rax,%%rdi\n\t" \ "jc ret_from_fork\n\t" \ RESTORE_CONTEXT \ + "\n.globl __switch_to_end\n\t" \ + "__switch_to_end:\n\t" \ : "=a" (last) \: [next] " S " (next), [prev] " D " (prev), \ [threadrsp] " i" (offsetof(struct task_struct, thread.rsp)), \
lib/Kconfig.kgdb +1 -0
@@ -13,6 +13,7 @@ config UNWIND_INFO config KGDB bool "KGDB: kernel debugging with remote gdb" select WANT_EXTRA_DEBUG_INFORMATION + select KGDB_ARCH_HAS_SHADOW_INFO if X86_64 depends on DEBUG_KERNEL && (X86 || MIPS || IA64 || PPC) help If you say Y here, it will be possible to remotely debug the
arch/x86/kernel/traps_64.c +6 -1
@@ -546,8 +546,13 @@ void die(const char * str, struct pt_regvoid __kprobes die_nmi (char *str,struct pt_regs *regs,int do_panic) { -unsigned long flags =oops_begin (); +unsigned long flags; +if (notify_die (DIE_NMIWATCHDOG ,"nmi" , regs,0 ,2 ,SIGINT ) + ==NOTIFY_STOP ) +return ; + + flags =oops_begin ();/* * We are in trouble anyway, lets at least try * to get a message out.