/* * Derived from "arch/i386/kernel/process.c" * Copyright (C) 1995 Linus Torvalds * * Updated and modified by Cort Dougan (cort@cs.nmt.edu) and * Paul Mackerras (paulus@cs.anu.edu.au) * * PowerPC version * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */#include<linux/errno.h>#include<linux/sched.h>#include<linux/kernel.h>#include<linux/mm.h>#include<linux/smp.h>#include<linux/stddef.h>#include<linux/unistd.h>#include<linux/ptrace.h>#include<linux/slab.h>#include<linux/user.h>#include<linux/elf.h>#include<linux/init.h>#include<linux/prctl.h>#include<linux/init_task.h>#include<linux/export.h>#include<linux/kallsyms.h>#include<linux/mqueue.h>#include<linux/hardirq.h>#include<linux/utsname.h>#include<linux/ftrace.h>#include<linux/kernel_stat.h>#include<linux/personality.h>#include<linux/random.h>#include<linux/hw_breakpoint.h>#include<asm/pgtable.h>#include<asm/uaccess.h>#include<asm/system.h>#include<asm/io.h>#include<asm/processor.h>#include<asm/mmu.h>#include<asm/prom.h>#include<asm/machdep.h>#include<asm/time.h>#include<asm/syscalls.h>#ifdef CONFIG_PPC64#include<asm/firmware.h>#endif#include<linux/kprobes.h>#include<linux/kdebug.h>externunsignedlong_get_SP(void);#ifndef CONFIG_SMPstructtask_struct*last_task_used_math=NULL;structtask_struct*last_task_used_altivec=NULL;structtask_struct*last_task_used_vsx=NULL;structtask_struct*last_task_used_spe=NULL;#endif/* * Make sure the floating-point register state in the * the thread_struct is up to date for task tsk. */voidflush_fp_to_thread(structtask_struct*tsk){if(tsk->thread.regs){/* * We need to disable preemption here because if we didn't, * another process could get scheduled after the regs->msr * test but before we have finished saving the FP registers * to the thread_struct. That process could take over the * FPU, and then when we get scheduled again we would store * bogus values for the remaining FP registers. */preempt_disable();if(tsk->thread.regs->msr&MSR_FP){#ifdef CONFIG_SMP/* * This should only ever be called for current or * for a stopped child process. Since we save away * the FP register state on context switch on SMP, * there is something wrong if a stopped child appears * to still have its FP state in the CPU registers. */BUG_ON(tsk!=current);#endifgiveup_fpu(tsk);}preempt_enable();}}EXPORT_SYMBOL_GPL(flush_fp_to_thread);voidenable_kernel_fp(void){WARN_ON(preemptible());#ifdef CONFIG_SMPif(current->thread.regs&&(current->thread.