diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-08-14 06:19:59 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-08-14 06:19:59 -0400 |
commit | 8d7ccaa545490cdffdfaff0842436a8dd85cf47b (patch) | |
tree | 8129b5907161bc6ae26deb3645ce1e280c5e1f51 /arch/x86/kernel/signal_64.c | |
parent | b2139aa0eec330c711c5a279db361e5ef1178e78 (diff) | |
parent | 30a2f3c60a84092c8084dfe788b710f8d0768cd4 (diff) |
Merge commit 'v2.6.27-rc3' into x86/prototypes
Conflicts:
include/asm-x86/dma-mapping.h
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/signal_64.c')
-rw-r--r-- | arch/x86/kernel/signal_64.c | 56 |
1 files changed, 53 insertions, 3 deletions
diff --git a/arch/x86/kernel/signal_64.c b/arch/x86/kernel/signal_64.c index b95a0a609053..02b02583f5b5 100644 --- a/arch/x86/kernel/signal_64.c +++ b/arch/x86/kernel/signal_64.c | |||
@@ -54,6 +54,59 @@ sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, | |||
54 | return do_sigaltstack(uss, uoss, regs->sp); | 54 | return do_sigaltstack(uss, uoss, regs->sp); |
55 | } | 55 | } |
56 | 56 | ||
57 | /* | ||
58 | * Signal frame handlers. | ||
59 | */ | ||
60 | |||
61 | static inline int save_i387(struct _fpstate __user *buf) | ||
62 | { | ||
63 | struct task_struct *tsk = current; | ||
64 | int err = 0; | ||
65 | |||
66 | BUILD_BUG_ON(sizeof(struct user_i387_struct) != | ||
67 | sizeof(tsk->thread.xstate->fxsave)); | ||
68 | |||
69 | if ((unsigned long)buf % 16) | ||
70 | printk("save_i387: bad fpstate %p\n", buf); | ||
71 | |||
72 | if (!used_math()) | ||
73 | return 0; | ||
74 | clear_used_math(); /* trigger finit */ | ||
75 | if (task_thread_info(tsk)->status & TS_USEDFPU) { | ||
76 | err = save_i387_checking((struct i387_fxsave_struct __user *) | ||
77 | buf); | ||
78 | if (err) | ||
79 | return err; | ||
80 | task_thread_info(tsk)->status &= ~TS_USEDFPU; | ||
81 | stts(); | ||
82 | } else { | ||
83 | if (__copy_to_user(buf, &tsk->thread.xstate->fxsave, | ||
84 | sizeof(struct i387_fxsave_struct))) | ||
85 | return -1; | ||
86 | } | ||
87 | return 1; | ||
88 | } | ||
89 | |||
90 | /* | ||
91 | * This restores directly out of user space. Exceptions are handled. | ||
92 | */ | ||
93 | static inline int restore_i387(struct _fpstate __user *buf) | ||
94 | { | ||
95 | struct task_struct *tsk = current; | ||
96 | int err; | ||
97 | |||
98 | if (!used_math()) { | ||
99 | err = init_fpu(tsk); | ||
100 | if (err) | ||
101 | return err; | ||
102 | } | ||
103 | |||
104 | if (!(task_thread_info(current)->status & TS_USEDFPU)) { | ||
105 | clts(); | ||
106 | task_thread_info(current)->status |= TS_USEDFPU; | ||
107 | } | ||
108 | return restore_fpu_checking((__force struct i387_fxsave_struct *)buf); | ||
109 | } | ||
57 | 110 | ||
58 | /* | 111 | /* |
59 | * Do a signal return; undo the signal stack. | 112 | * Do a signal return; undo the signal stack. |
@@ -497,9 +550,6 @@ void do_notify_resume(struct pt_regs *regs, void *unused, | |||
497 | /* deal with pending signal delivery */ | 550 | /* deal with pending signal delivery */ |
498 | if (thread_info_flags & _TIF_SIGPENDING) | 551 | if (thread_info_flags & _TIF_SIGPENDING) |
499 | do_signal(regs); | 552 | do_signal(regs); |
500 | |||
501 | if (thread_info_flags & _TIF_HRTICK_RESCHED) | ||
502 | hrtick_resched(); | ||
503 | } | 553 | } |
504 | 554 | ||
505 | void signal_fault(struct pt_regs *regs, void __user *frame, char *where) | 555 | void signal_fault(struct pt_regs *regs, void __user *frame, char *where) |