aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64/kernel/entry.S
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2006-01-11 16:43:00 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-11 22:01:13 -0500
commitb556b35e98ad2b9174a7a623d152cdf412d1a999 (patch)
tree10f99d70e719fba811dee85d2f3a82b26d7a4ce8 /arch/x86_64/kernel/entry.S
parented8388a5d9db0445322f86ee8381b0f04a2057ee (diff)
[PATCH] x86_64: Move int 3 handler to debug stack and allow to increase it.
This - switches the INT3 handler to run on an IST stack (to cope with breakpoints set by a kernel debugger on places where the kernel's %gs base hasn't been set up, yet); the IST stack used is shared with the INT1 handler's [AK: this also allows setting a kprobe on the interrupt/exception entry points] - allows nesting of INT1/INT3 handlers so that one can, with a kernel debugger, debug (at least) the user-mode portions of the INT1/INT3 handling; the nesting isn't actively enabled here since a kernel- debugger-free kernel doesn't need it Signed-Off-By: Jan Beulich <jbeulich@novell.com> Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/x86_64/kernel/entry.S')
-rw-r--r--arch/x86_64/kernel/entry.S26
1 files changed, 22 insertions, 4 deletions
diff --git a/arch/x86_64/kernel/entry.S b/arch/x86_64/kernel/entry.S
index bd21ebafaf66..28b3c8e6b044 100644
--- a/arch/x86_64/kernel/entry.S
+++ b/arch/x86_64/kernel/entry.S
@@ -673,7 +673,10 @@ ENTRY(spurious_interrupt)
673 673
674 /* error code is on the stack already */ 674 /* error code is on the stack already */
675 /* handle NMI like exceptions that can happen everywhere */ 675 /* handle NMI like exceptions that can happen everywhere */
676 .macro paranoidentry sym 676#ifndef DEBUG_IST
677# define DEBUG_IST 0
678#endif
679 .macro paranoidentry sym, ist=0
677 SAVE_ALL 680 SAVE_ALL
678 cld 681 cld
679 movl $1,%ebx 682 movl $1,%ebx
@@ -683,10 +686,20 @@ ENTRY(spurious_interrupt)
683 js 1f 686 js 1f
684 swapgs 687 swapgs
685 xorl %ebx,%ebx 688 xorl %ebx,%ebx
6861: movq %rsp,%rdi 6891:
690 .if \ist
691 movq %gs:pda_data_offset, %rbp
692 .endif
693 movq %rsp,%rdi
687 movq ORIG_RAX(%rsp),%rsi 694 movq ORIG_RAX(%rsp),%rsi
688 movq $-1,ORIG_RAX(%rsp) 695 movq $-1,ORIG_RAX(%rsp)
696 .if \ist
697 subq $EXCEPTION_STACK_SIZE, per_cpu__init_tss + TSS_ist + (\ist - 1) * 8(%rbp)
698 .endif
689 call \sym 699 call \sym
700 .if \ist
701 addq $EXCEPTION_STACK_SIZE, per_cpu__init_tss + TSS_ist + (\ist - 1) * 8(%rbp)
702 .endif
690 cli 703 cli
691 .endm 704 .endm
692 705
@@ -904,7 +917,7 @@ KPROBE_ENTRY(debug)
904 INTR_FRAME 917 INTR_FRAME
905 pushq $0 918 pushq $0
906 CFI_ADJUST_CFA_OFFSET 8 919 CFI_ADJUST_CFA_OFFSET 8
907 paranoidentry do_debug 920 paranoidentry do_debug, DEBUG_IST
908 jmp paranoid_exit 921 jmp paranoid_exit
909 CFI_ENDPROC 922 CFI_ENDPROC
910 .previous .text 923 .previous .text
@@ -959,7 +972,12 @@ paranoid_schedule:
959 CFI_ENDPROC 972 CFI_ENDPROC
960 973
961KPROBE_ENTRY(int3) 974KPROBE_ENTRY(int3)
962 zeroentry do_int3 975 INTR_FRAME
976 pushq $0
977 CFI_ADJUST_CFA_OFFSET 8
978 paranoidentry do_int3, DEBUG_IST
979 jmp paranoid_exit
980 CFI_ENDPROC
963 .previous .text 981 .previous .text
964 982
965ENTRY(overflow) 983ENTRY(overflow)