aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/process_64.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/kernel/process_64.c')
-rw-r--r--arch/sh/kernel/process_64.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/arch/sh/kernel/process_64.c b/arch/sh/kernel/process_64.c
index 973dd1a3d292..cff3b7dc9c56 100644
--- a/arch/sh/kernel/process_64.c
+++ b/arch/sh/kernel/process_64.c
@@ -421,19 +421,22 @@ int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
421 */ 421 */
422void exit_thread(void) 422void exit_thread(void)
423{ 423{
424 /* See arch/sparc/kernel/process.c for the precedent for doing this -- RPC. 424 /*
425 425 * See arch/sparc/kernel/process.c for the precedent for doing
426 The SH-5 FPU save/restore approach relies on last_task_used_math 426 * this -- RPC.
427 pointing to a live task_struct. When another task tries to use the 427 *
428 FPU for the 1st time, the FPUDIS trap handling (see 428 * The SH-5 FPU save/restore approach relies on
429 arch/sh64/kernel/fpu.c) will save the existing FPU state to the 429 * last_task_used_math pointing to a live task_struct. When
430 FP regs field within last_task_used_math before re-loading the new 430 * another task tries to use the FPU for the 1st time, the FPUDIS
431 task's FPU state (or initialising it if the FPU has been used 431 * trap handling (see arch/sh/kernel/cpu/sh5/fpu.c) will save the
432 before). So if last_task_used_math is stale, and its page has already been 432 * existing FPU state to the FP regs field within
433 re-allocated for another use, the consequences are rather grim. Unless we 433 * last_task_used_math before re-loading the new task's FPU state
434 null it here, there is no other path through which it would get safely 434 * (or initialising it if the FPU has been used before). So if
435 nulled. */ 435 * last_task_used_math is stale, and its page has already been
436 436 * re-allocated for another use, the consequences are rather
437 * grim. Unless we null it here, there is no other path through
438 * which it would get safely nulled.
439 */
437#ifdef CONFIG_SH_FPU 440#ifdef CONFIG_SH_FPU
438 if (last_task_used_math == current) { 441 if (last_task_used_math == current) {
439 last_task_used_math = NULL; 442 last_task_used_math = NULL;