diff options
author | Keith Owens <kaos@ocs.com.au> | 2006-08-30 13:37:19 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-08-30 19:05:16 -0400 |
commit | 01ebb77b31149d847726a8847ad0d37631d7f049 (patch) | |
tree | a91d01f8c17d24041a4f2015e093ddfbd9defa1e | |
parent | 386dcafaacd212ef4a8aeed67a7db3ffbb44c7b2 (diff) |
[PATCH] x86_64: Save original IST values for checking stack addresses
The values in init_tss.ist[] can change when an IST event occurs. Save
the original IST values for checking stack addresses when debugging or
doing stack traces.
Signed-off-by: Keith Owens <kaos@ocs.com.au>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | arch/x86_64/kernel/init_task.c | 5 | ||||
-rw-r--r-- | arch/x86_64/kernel/setup64.c | 3 | ||||
-rw-r--r-- | arch/x86_64/kernel/traps.c | 2 | ||||
-rw-r--r-- | include/asm-x86_64/processor.h | 6 |
4 files changed, 14 insertions, 2 deletions
diff --git a/arch/x86_64/kernel/init_task.c b/arch/x86_64/kernel/init_task.c index ce31d904d601..3dc5854ba21e 100644 --- a/arch/x86_64/kernel/init_task.c +++ b/arch/x86_64/kernel/init_task.c | |||
@@ -46,4 +46,9 @@ EXPORT_SYMBOL(init_task); | |||
46 | */ | 46 | */ |
47 | DEFINE_PER_CPU(struct tss_struct, init_tss) ____cacheline_internodealigned_in_smp = INIT_TSS; | 47 | DEFINE_PER_CPU(struct tss_struct, init_tss) ____cacheline_internodealigned_in_smp = INIT_TSS; |
48 | 48 | ||
49 | /* Copies of the original ist values from the tss are only accessed during | ||
50 | * debugging, no special alignment required. | ||
51 | */ | ||
52 | DEFINE_PER_CPU(struct orig_ist, orig_ist); | ||
53 | |||
49 | #define ALIGN_TO_4K __attribute__((section(".data.init_task"))) | 54 | #define ALIGN_TO_4K __attribute__((section(".data.init_task"))) |
diff --git a/arch/x86_64/kernel/setup64.c b/arch/x86_64/kernel/setup64.c index 6fe58a634b5f..417de564456e 100644 --- a/arch/x86_64/kernel/setup64.c +++ b/arch/x86_64/kernel/setup64.c | |||
@@ -189,6 +189,7 @@ void __cpuinit cpu_init (void) | |||
189 | { | 189 | { |
190 | int cpu = stack_smp_processor_id(); | 190 | int cpu = stack_smp_processor_id(); |
191 | struct tss_struct *t = &per_cpu(init_tss, cpu); | 191 | struct tss_struct *t = &per_cpu(init_tss, cpu); |
192 | struct orig_ist *orig_ist = &per_cpu(orig_ist, cpu); | ||
192 | unsigned long v; | 193 | unsigned long v; |
193 | char *estacks = NULL; | 194 | char *estacks = NULL; |
194 | struct task_struct *me; | 195 | struct task_struct *me; |
@@ -256,7 +257,7 @@ void __cpuinit cpu_init (void) | |||
256 | estacks += EXCEPTION_STKSZ; | 257 | estacks += EXCEPTION_STKSZ; |
257 | break; | 258 | break; |
258 | } | 259 | } |
259 | t->ist[v] = (unsigned long)estacks; | 260 | orig_ist->ist[v] = t->ist[v] = (unsigned long)estacks; |
260 | } | 261 | } |
261 | 262 | ||
262 | t->io_bitmap_base = offsetof(struct tss_struct, io_bitmap); | 263 | t->io_bitmap_base = offsetof(struct tss_struct, io_bitmap); |
diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c index 5e00af54af65..b1249774d1e8 100644 --- a/arch/x86_64/kernel/traps.c +++ b/arch/x86_64/kernel/traps.c | |||
@@ -178,7 +178,7 @@ static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack, | |||
178 | break; | 178 | break; |
179 | #endif | 179 | #endif |
180 | default: | 180 | default: |
181 | end = per_cpu(init_tss, cpu).ist[k]; | 181 | end = per_cpu(orig_ist, cpu).ist[k]; |
182 | break; | 182 | break; |
183 | } | 183 | } |
184 | /* | 184 | /* |
diff --git a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h index 3b3c1217fe61..de9c3147ee4c 100644 --- a/include/asm-x86_64/processor.h +++ b/include/asm-x86_64/processor.h | |||
@@ -232,8 +232,14 @@ struct tss_struct { | |||
232 | unsigned long io_bitmap[IO_BITMAP_LONGS + 1]; | 232 | unsigned long io_bitmap[IO_BITMAP_LONGS + 1]; |
233 | } __attribute__((packed)) ____cacheline_aligned; | 233 | } __attribute__((packed)) ____cacheline_aligned; |
234 | 234 | ||
235 | |||
235 | extern struct cpuinfo_x86 boot_cpu_data; | 236 | extern struct cpuinfo_x86 boot_cpu_data; |
236 | DECLARE_PER_CPU(struct tss_struct,init_tss); | 237 | DECLARE_PER_CPU(struct tss_struct,init_tss); |
238 | /* Save the original ist values for checking stack pointers during debugging */ | ||
239 | struct orig_ist { | ||
240 | unsigned long ist[7]; | ||
241 | }; | ||
242 | DECLARE_PER_CPU(struct orig_ist, orig_ist); | ||
237 | 243 | ||
238 | #ifdef CONFIG_X86_VSMP | 244 | #ifdef CONFIG_X86_VSMP |
239 | #define ARCH_MIN_TASKALIGN (1 << INTERNODE_CACHE_SHIFT) | 245 | #define ARCH_MIN_TASKALIGN (1 << INTERNODE_CACHE_SHIFT) |