Commit 44210111 authored by Roland McGrath's avatar Roland McGrath Committed by Ingo Molnar

x86: x86 i387 user_regset

This revamps the i387 code to be shared across 32-bit, 64-bit,
and 32-on-64.  It does so by consolidating the code in one place
based on the user_regset accessor interfaces.  This switches
32-bit to using the i387_64.h header and 64-bit to using the
i387.c that was previously i387_32.c, but that's what took the
least cleanup in each file.  Here i387.h is stubbed to always
include i387_64.h rather than renaming the file, to keep this
diff smaller and easier to read.
Signed-off-by: default avatarRoland McGrath <roland@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent b7b71725
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# #
obj-$(CONFIG_IA32_EMULATION) := ia32entry.o sys_ia32.o ia32_signal.o \ obj-$(CONFIG_IA32_EMULATION) := ia32entry.o sys_ia32.o ia32_signal.o \
ia32_binfmt.o fpu32.o ia32_binfmt.o
sysv-$(CONFIG_SYSVIPC) := ipc32.o sysv-$(CONFIG_SYSVIPC) := ipc32.o
obj-$(CONFIG_IA32_EMULATION) += $(sysv-y) obj-$(CONFIG_IA32_EMULATION) += $(sysv-y)
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include <asm/ia32_unistd.h> #include <asm/ia32_unistd.h>
#include <asm/user32.h> #include <asm/user32.h>
#include <asm/sigcontext32.h> #include <asm/sigcontext32.h>
#include <asm/fpu32.h>
#include <asm/proto.h> #include <asm/proto.h>
#include <asm/vdso.h> #include <asm/vdso.h>
...@@ -258,7 +257,7 @@ static int ia32_restore_sigcontext(struct pt_regs *regs, ...@@ -258,7 +257,7 @@ static int ia32_restore_sigcontext(struct pt_regs *regs,
if (buf) { if (buf) {
if (!access_ok(VERIFY_READ, buf, sizeof(*buf))) if (!access_ok(VERIFY_READ, buf, sizeof(*buf)))
goto badframe; goto badframe;
err |= restore_i387_ia32(current, buf, 0); err |= restore_i387_ia32(buf);
} else { } else {
struct task_struct *me = current; struct task_struct *me = current;
...@@ -377,7 +376,7 @@ static int ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc, ...@@ -377,7 +376,7 @@ static int ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc,
err |= __put_user((u32)regs->flags, &sc->flags); err |= __put_user((u32)regs->flags, &sc->flags);
err |= __put_user((u32)regs->sp, &sc->sp_at_signal); err |= __put_user((u32)regs->sp, &sc->sp_at_signal);
tmp = save_i387_ia32(current, fpstate, regs, 0); tmp = save_i387_ia32(fpstate);
if (tmp < 0) if (tmp < 0)
err = -EFAULT; err = -EFAULT;
else { else {
......
...@@ -7,7 +7,7 @@ CPPFLAGS_vmlinux.lds += -Ux86_64 ...@@ -7,7 +7,7 @@ CPPFLAGS_vmlinux.lds += -Ux86_64
obj-y := process_64.o signal_64.o entry_64.o traps_64.o irq_64.o \ obj-y := process_64.o signal_64.o entry_64.o traps_64.o irq_64.o \
time_64.o ioport_64.o ldt.o setup_64.o i8259_64.o sys_x86_64.o \ time_64.o ioport_64.o ldt.o setup_64.o i8259_64.o sys_x86_64.o \
x8664_ksyms_64.o i387_64.o syscall_64.o vsyscall_64.o \ x8664_ksyms_64.o syscall_64.o vsyscall_64.o \
setup64.o bootflag.o e820_64.o reboot_64.o quirks.o i8237.o \ setup64.o bootflag.o e820_64.o reboot_64.o quirks.o i8237.o \
pci-dma_64.o pci-nommu_64.o alternative.o hpet.o tsc_64.o bugs_64.o \ pci-dma_64.o pci-nommu_64.o alternative.o hpet.o tsc_64.o bugs_64.o \
i8253.o io_delay.o rtc.o i8253.o io_delay.o rtc.o
...@@ -16,6 +16,7 @@ obj-y += ptrace.o ...@@ -16,6 +16,7 @@ obj-y += ptrace.o
obj-y += ds.o obj-y += ds.o
obj-y += step.o obj-y += step.o
obj-y += i387.o
obj-$(CONFIG_IA32_EMULATION) += tls.o obj-$(CONFIG_IA32_EMULATION) += tls.o
obj-$(CONFIG_STACKTRACE) += stacktrace.o obj-$(CONFIG_STACKTRACE) += stacktrace.o
obj-y += cpu/ obj-y += cpu/
......
This diff is collapsed.
...@@ -886,7 +886,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -886,7 +886,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
#include <linux/compat.h> #include <linux/compat.h>
#include <linux/syscalls.h> #include <linux/syscalls.h>
#include <asm/ia32.h> #include <asm/ia32.h>
#include <asm/fpu32.h>
#include <asm/user32.h> #include <asm/user32.h>
#define R32(l,q) \ #define R32(l,q) \
......
#ifndef _FPU32_H
#define _FPU32_H 1
struct _fpstate_ia32;
int restore_i387_ia32(struct task_struct *tsk, struct _fpstate_ia32 __user *buf, int fsave);
int save_i387_ia32(struct task_struct *tsk, struct _fpstate_ia32 __user *buf,
struct pt_regs *regs, int fsave);
#endif
#ifdef CONFIG_X86_32 #include "i387_64.h"
# include "i387_32.h"
#else
# include "i387_64.h"
#endif
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/kernel_stat.h> #include <linux/kernel_stat.h>
#include <linux/regset.h>
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/sigcontext.h> #include <asm/sigcontext.h>
#include <asm/user.h> #include <asm/user.h>
...@@ -23,6 +24,16 @@ extern void mxcsr_feature_mask_init(void); ...@@ -23,6 +24,16 @@ extern void mxcsr_feature_mask_init(void);
extern void init_fpu(struct task_struct *child); extern void init_fpu(struct task_struct *child);
extern asmlinkage void math_state_restore(void); extern asmlinkage void math_state_restore(void);
extern user_regset_active_fn fpregs_active, xfpregs_active;
extern user_regset_get_fn fpregs_get, xfpregs_get, fpregs_soft_get;
extern user_regset_set_fn fpregs_set, xfpregs_set, fpregs_soft_set;
#ifdef CONFIG_IA32_EMULATION
struct _fpstate_ia32;
extern int save_i387_ia32(struct _fpstate_ia32 __user *buf);
extern int restore_i387_ia32(struct _fpstate_ia32 __user *buf);
#endif
#ifdef CONFIG_X86_64 #ifdef CONFIG_X86_64
/* Ignore delayed exceptions from user space */ /* Ignore delayed exceptions from user space */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment