aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-i386
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-i386')
-rw-r--r--include/asm-i386/emergency-restart.h6
-rw-r--r--include/asm-i386/i387.h26
-rw-r--r--include/asm-i386/ptrace.h13
3 files changed, 34 insertions, 11 deletions
diff --git a/include/asm-i386/emergency-restart.h b/include/asm-i386/emergency-restart.h
new file mode 100644
index 000000000000..680c39563345
--- /dev/null
+++ b/include/asm-i386/emergency-restart.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_EMERGENCY_RESTART_H
2#define _ASM_EMERGENCY_RESTART_H
3
4extern void machine_emergency_restart(void);
5
6#endif /* _ASM_EMERGENCY_RESTART_H */
diff --git a/include/asm-i386/i387.h b/include/asm-i386/i387.h
index f6feb98a9397..6747006743f9 100644
--- a/include/asm-i386/i387.h
+++ b/include/asm-i386/i387.h
@@ -19,10 +19,21 @@
19 19
20extern void mxcsr_feature_mask_init(void); 20extern void mxcsr_feature_mask_init(void);
21extern void init_fpu(struct task_struct *); 21extern void init_fpu(struct task_struct *);
22
22/* 23/*
23 * FPU lazy state save handling... 24 * FPU lazy state save handling...
24 */ 25 */
25extern void restore_fpu( struct task_struct *tsk ); 26
27/*
28 * The "nop" is needed to make the instructions the same
29 * length.
30 */
31#define restore_fpu(tsk) \
32 alternative_input( \
33 "nop ; frstor %1", \
34 "fxrstor %1", \
35 X86_FEATURE_FXSR, \
36 "m" ((tsk)->thread.i387.fxsave))
26 37
27extern void kernel_fpu_begin(void); 38extern void kernel_fpu_begin(void);
28#define kernel_fpu_end() do { stts(); preempt_enable(); } while(0) 39#define kernel_fpu_end() do { stts(); preempt_enable(); } while(0)
@@ -32,13 +43,12 @@ extern void kernel_fpu_begin(void);
32 */ 43 */
33static inline void __save_init_fpu( struct task_struct *tsk ) 44static inline void __save_init_fpu( struct task_struct *tsk )
34{ 45{
35 if ( cpu_has_fxsr ) { 46 alternative_input(
36 asm volatile( "fxsave %0 ; fnclex" 47 "fnsave %1 ; fwait ;" GENERIC_NOP2,
37 : "=m" (tsk->thread.i387.fxsave) ); 48 "fxsave %1 ; fnclex",
38 } else { 49 X86_FEATURE_FXSR,
39 asm volatile( "fnsave %0 ; fwait" 50 "m" (tsk->thread.i387.fxsave)
40 : "=m" (tsk->thread.i387.fsave) ); 51 :"memory");
41 }
42 tsk->thread_info->status &= ~TS_USEDFPU; 52 tsk->thread_info->status &= ~TS_USEDFPU;
43} 53}
44 54
diff --git a/include/asm-i386/ptrace.h b/include/asm-i386/ptrace.h
index eef9f93870d4..b926cb4f4cfd 100644
--- a/include/asm-i386/ptrace.h
+++ b/include/asm-i386/ptrace.h
@@ -57,14 +57,21 @@ struct pt_regs {
57#ifdef __KERNEL__ 57#ifdef __KERNEL__
58struct task_struct; 58struct task_struct;
59extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code); 59extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code);
60#define user_mode(regs) (3 & (regs)->xcs) 60
61#define user_mode_vm(regs) ((VM_MASK & (regs)->eflags) || user_mode(regs)) 61static inline int user_mode(struct pt_regs *regs)
62{
63 return (regs->xcs & 3) != 0;
64}
65static inline int user_mode_vm(struct pt_regs *regs)
66{
67 return ((regs->xcs & 3) | (regs->eflags & VM_MASK)) != 0;
68}
62#define instruction_pointer(regs) ((regs)->eip) 69#define instruction_pointer(regs) ((regs)->eip)
63#if defined(CONFIG_SMP) && defined(CONFIG_FRAME_POINTER) 70#if defined(CONFIG_SMP) && defined(CONFIG_FRAME_POINTER)
64extern unsigned long profile_pc(struct pt_regs *regs); 71extern unsigned long profile_pc(struct pt_regs *regs);
65#else 72#else
66#define profile_pc(regs) instruction_pointer(regs) 73#define profile_pc(regs) instruction_pointer(regs)
67#endif 74#endif
68#endif 75#endif /* __KERNEL__ */
69 76
70#endif 77#endif