diff options
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kernel/i387.c | 105 | ||||
-rw-r--r-- | arch/x86/kernel/process_32.c | 16 | ||||
-rw-r--r-- | arch/x86/kernel/process_64.c | 19 | ||||
-rw-r--r-- | arch/x86/math-emu/fpu_entry.c | 14 |
4 files changed, 9 insertions, 145 deletions
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c index f7f7568dd7b..26719bd2c77 100644 --- a/arch/x86/kernel/i387.c +++ b/arch/x86/kernel/i387.c @@ -454,113 +454,26 @@ int restore_i387_ia32(struct _fpstate_ia32 __user *buf) return err; } -#endif /* CONFIG_X86_32 || CONFIG_IA32_EMULATION */ - -#ifdef CONFIG_X86_64 - -int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *tsk) -{ - return xfpregs_get(tsk, NULL, 0, sizeof(*buf), NULL, buf); -} - -int set_fpregs(struct task_struct *tsk, struct user_i387_struct __user *buf) -{ - return xfpregs_set(tsk, NULL, 0, sizeof(*buf), NULL, buf); -} - -#else - -int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *tsk) -{ - return fpregs_get(tsk, NULL, 0, sizeof(*buf), NULL, buf); -} - -int set_fpregs(struct task_struct *tsk, struct user_i387_struct __user *buf) -{ - return fpregs_set(tsk, NULL, 0, sizeof(*buf), NULL, buf); -} - -int get_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *tsk) -{ - return xfpregs_get(tsk, NULL, 0, sizeof(*buf), NULL, buf); -} - -int set_fpxregs(struct task_struct *tsk, struct user_fxsr_struct __user *buf) -{ - return xfpregs_get(tsk, NULL, 0, sizeof(*buf), NULL, buf); -} - -#endif - /* * FPU state for core dumps. + * This is only used for a.out dumps now. + * It is declared generically using elf_fpregset_t (which is + * struct user_i387_struct) but is in fact only used for 32-bit + * dumps, so on 64-bit it is really struct user_i387_ia32_struct. */ - -static inline void copy_fpu_fsave(struct task_struct *tsk, - struct user_i387_struct *fpu) -{ - memcpy(fpu, &tsk->thread.i387.fsave, - sizeof(struct user_i387_struct)); -} - -static inline void copy_fpu_fxsave(struct task_struct *tsk, - struct user_i387_struct *fpu) -{ - unsigned short *to; - unsigned short *from; - int i; - - memcpy(fpu, &tsk->thread.i387.fxsave, 7 * sizeof(long)); - - to = (unsigned short *)&fpu->st_space[0]; - from = (unsigned short *)&tsk->thread.i387.fxsave.st_space[0]; - for (i = 0; i < 8; i++, to += 5, from += 8) - memcpy(to, from, 5 * sizeof(unsigned short)); -} - int dump_fpu(struct pt_regs *regs, struct user_i387_struct *fpu) { int fpvalid; struct task_struct *tsk = current; fpvalid = !!used_math(); - if (fpvalid) { - unlazy_fpu(tsk); - if (cpu_has_fxsr) { - copy_fpu_fxsave(tsk, fpu); - } else { - copy_fpu_fsave(tsk, fpu); - } - } + if (fpvalid) + fpvalid = !fpregs_get(tsk, NULL, + 0, sizeof(struct user_i387_ia32_struct), + fpu, NULL); return fpvalid; } EXPORT_SYMBOL(dump_fpu); -int dump_task_fpu(struct task_struct *tsk, struct user_i387_struct *fpu) -{ - int fpvalid = !!tsk_used_math(tsk); - - if (fpvalid) { - if (tsk == current) - unlazy_fpu(tsk); - if (cpu_has_fxsr) - copy_fpu_fxsave(tsk, fpu); - else - copy_fpu_fsave(tsk, fpu); - } - return fpvalid; -} - -int dump_task_extended_fpu(struct task_struct *tsk, - struct user32_fxsr_struct *fpu) -{ - int fpvalid = tsk_used_math(tsk) && cpu_has_fxsr; - - if (fpvalid) { - if (tsk == current) - unlazy_fpu(tsk); - memcpy(fpu, &tsk->thread.i387.fxsave, sizeof(*fpu)); - } - return fpvalid; -} +#endif /* CONFIG_X86_32 || CONFIG_IA32_EMULATION */ diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c index 40cc29695eb..35a6f318c54 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c @@ -571,22 +571,6 @@ void dump_thread(struct pt_regs * regs, struct user * dump) } EXPORT_SYMBOL(dump_thread); -/* - * Capture the user space registers if the task is not running (in user space) - */ -int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs) -{ - struct pt_regs ptregs = *task_pt_regs(tsk); - ptregs.cs &= 0xffff; - ptregs.ds &= 0xffff; - ptregs.es &= 0xffff; - ptregs.ss &= 0xffff; - - elf_core_copy_regs(regs, &ptregs); - - return 1; -} - #ifdef CONFIG_SECCOMP static void hard_disable_TSC(void) { diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index e3a3610ade1..78d80067b7f 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c @@ -544,24 +544,6 @@ out: */ #define loaddebug(thread, r) set_debugreg(thread->debugreg ## r, r) -/* - * Capture the user space registers if the task is not running (in user space) - */ -int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs) -{ - struct pt_regs *pp, ptregs; - - pp = task_pt_regs(tsk); - - ptregs = *pp; - ptregs.cs &= 0xffff; - ptregs.ss &= 0xffff; - - elf_core_copy_regs(regs, &ptregs); - - return 1; -} - static inline void __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p, struct tss_struct *tss) @@ -929,4 +911,3 @@ unsigned long arch_randomize_brk(struct mm_struct *mm) unsigned long range_end = mm->brk + 0x02000000; return randomize_range(mm->brk, range_end, 0) ? : mm->brk; } - diff --git a/arch/x86/math-emu/fpu_entry.c b/arch/x86/math-emu/fpu_entry.c index cfbdaa1532c..760baeea5f0 100644 --- a/arch/x86/math-emu/fpu_entry.c +++ b/arch/x86/math-emu/fpu_entry.c @@ -761,17 +761,3 @@ int fpregs_soft_get(struct task_struct *target, return ret; } - -int save_i387_soft(void *s387, struct _fpstate __user *buf) -{ - return fpregs_soft_get(current, NULL, - 0, sizeof(struct user_i387_struct), - NULL, buf) ? -1 : 1; -} - -int restore_i387_soft(void *s387, struct _fpstate __user *buf) -{ - return fpregs_soft_set(current, NULL, - 0, sizeof(struct user_i387_struct), - NULL, buf) ? -1 : 1; -} |