aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/cpu/common.c')
-rw-r--r--arch/x86/kernel/cpu/common.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index aa003b13a831..266e4649b1da 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -1026,6 +1026,8 @@ __setup("clearcpuid=", setup_disablecpuid);
1026 1026
1027#ifdef CONFIG_X86_64 1027#ifdef CONFIG_X86_64
1028struct desc_ptr idt_descr = { NR_VECTORS * 16 - 1, (unsigned long) idt_table }; 1028struct desc_ptr idt_descr = { NR_VECTORS * 16 - 1, (unsigned long) idt_table };
1029struct desc_ptr nmi_idt_descr = { NR_VECTORS * 16 - 1,
1030 (unsigned long) nmi_idt_table };
1029 1031
1030DEFINE_PER_CPU_FIRST(union irq_stack_union, 1032DEFINE_PER_CPU_FIRST(union irq_stack_union,
1031 irq_stack_union) __aligned(PAGE_SIZE); 1033 irq_stack_union) __aligned(PAGE_SIZE);
@@ -1090,6 +1092,26 @@ unsigned long kernel_eflags;
1090 */ 1092 */
1091DEFINE_PER_CPU(struct orig_ist, orig_ist); 1093DEFINE_PER_CPU(struct orig_ist, orig_ist);
1092 1094
1095static DEFINE_PER_CPU(unsigned long, debug_stack_addr);
1096DEFINE_PER_CPU(int, debug_stack_usage);
1097
1098int is_debug_stack(unsigned long addr)
1099{
1100 return __get_cpu_var(debug_stack_usage) ||
1101 (addr <= __get_cpu_var(debug_stack_addr) &&
1102 addr > (__get_cpu_var(debug_stack_addr) - DEBUG_STKSZ));
1103}
1104
1105void debug_stack_set_zero(void)
1106{
1107 load_idt((const struct desc_ptr *)&nmi_idt_descr);
1108}
1109
1110void debug_stack_reset(void)
1111{
1112 load_idt((const struct desc_ptr *)&idt_descr);
1113}
1114
1093#else /* CONFIG_X86_64 */ 1115#else /* CONFIG_X86_64 */
1094 1116
1095DEFINE_PER_CPU(struct task_struct *, current_task) = &init_task; 1117DEFINE_PER_CPU(struct task_struct *, current_task) = &init_task;
@@ -1208,6 +1230,8 @@ void __cpuinit cpu_init(void)
1208 estacks += exception_stack_sizes[v]; 1230 estacks += exception_stack_sizes[v];
1209 oist->ist[v] = t->x86_tss.ist[v] = 1231 oist->ist[v] = t->x86_tss.ist[v] =
1210 (unsigned long)estacks; 1232 (unsigned long)estacks;
1233 if (v == DEBUG_STACK-1)
1234 per_cpu(debug_stack_addr, cpu) = (unsigned long)estacks;
1211 } 1235 }
1212 } 1236 }
1213 1237