diff options
author | Jan Beulich <jbeulich@novell.com> | 2006-01-11 16:43:00 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-11 22:01:13 -0500 |
commit | b556b35e98ad2b9174a7a623d152cdf412d1a999 (patch) | |
tree | 10f99d70e719fba811dee85d2f3a82b26d7a4ce8 /arch/x86_64/kernel/setup64.c | |
parent | ed8388a5d9db0445322f86ee8381b0f04a2057ee (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/setup64.c')
-rw-r--r-- | arch/x86_64/kernel/setup64.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/arch/x86_64/kernel/setup64.c b/arch/x86_64/kernel/setup64.c index 7b7131d8bc90..39e728cfe6a0 100644 --- a/arch/x86_64/kernel/setup64.c +++ b/arch/x86_64/kernel/setup64.c | |||
@@ -145,7 +145,7 @@ void pda_init(int cpu) | |||
145 | pda->irqstackptr += IRQSTACKSIZE-64; | 145 | pda->irqstackptr += IRQSTACKSIZE-64; |
146 | } | 146 | } |
147 | 147 | ||
148 | char boot_exception_stacks[N_EXCEPTION_STACKS * EXCEPTION_STKSZ] | 148 | char boot_exception_stacks[(N_EXCEPTION_STACKS - 2) * EXCEPTION_STKSZ + DEBUG_STKSZ] |
149 | __attribute__((section(".bss.page_aligned"))); | 149 | __attribute__((section(".bss.page_aligned"))); |
150 | 150 | ||
151 | /* May not be marked __init: used by software suspend */ | 151 | /* May not be marked __init: used by software suspend */ |
@@ -236,13 +236,27 @@ void __cpuinit cpu_init (void) | |||
236 | */ | 236 | */ |
237 | for (v = 0; v < N_EXCEPTION_STACKS; v++) { | 237 | for (v = 0; v < N_EXCEPTION_STACKS; v++) { |
238 | if (cpu) { | 238 | if (cpu) { |
239 | estacks = (char *)__get_free_pages(GFP_ATOMIC, | 239 | static const unsigned int order[N_EXCEPTION_STACKS] = { |
240 | EXCEPTION_STACK_ORDER); | 240 | [0 ... N_EXCEPTION_STACKS - 1] = EXCEPTION_STACK_ORDER, |
241 | [DEBUG_STACK - 1] = DEBUG_STACK_ORDER | ||
242 | }; | ||
243 | |||
244 | estacks = (char *)__get_free_pages(GFP_ATOMIC, order[v]); | ||
241 | if (!estacks) | 245 | if (!estacks) |
242 | panic("Cannot allocate exception stack %ld %d\n", | 246 | panic("Cannot allocate exception stack %ld %d\n", |
243 | v, cpu); | 247 | v, cpu); |
244 | } | 248 | } |
245 | estacks += EXCEPTION_STKSZ; | 249 | switch (v + 1) { |
250 | #if DEBUG_STKSZ > EXCEPTION_STKSZ | ||
251 | case DEBUG_STACK: | ||
252 | cpu_pda[cpu].debugstack = (unsigned long)estacks; | ||
253 | estacks += DEBUG_STKSZ; | ||
254 | break; | ||
255 | #endif | ||
256 | default: | ||
257 | estacks += EXCEPTION_STKSZ; | ||
258 | break; | ||
259 | } | ||
246 | t->ist[v] = (unsigned long)estacks; | 260 | t->ist[v] = (unsigned long)estacks; |
247 | } | 261 | } |
248 | 262 | ||