Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
[linux-2.6/mini2440.git] / include / asm-mn10300 / fpu.h
blob64a2b83a7a6aefb09490f4e68a8a3d8f67fa7686
1 /* MN10300 FPU definitions
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 * Derived from include/asm-i386/i387.h: Copyright (C) 1994 Linus Torvalds
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public Licence
9 * as published by the Free Software Foundation; either version
10 * 2 of the Licence, or (at your option) any later version.
12 #ifndef _ASM_FPU_H
13 #define _ASM_FPU_H
15 #include <asm/processor.h>
16 #include <asm/sigcontext.h>
17 #include <asm/user.h>
19 #ifdef __KERNEL__
21 /* the task that owns the FPU state */
22 extern struct task_struct *fpu_state_owner;
24 #define set_using_fpu(tsk) \
25 do { \
26 (tsk)->thread.fpu_flags |= THREAD_USING_FPU; \
27 } while (0)
29 #define clear_using_fpu(tsk) \
30 do { \
31 (tsk)->thread.fpu_flags &= ~THREAD_USING_FPU; \
32 } while (0)
34 #define is_using_fpu(tsk) ((tsk)->thread.fpu_flags & THREAD_USING_FPU)
36 #define unlazy_fpu(tsk) \
37 do { \
38 preempt_disable(); \
39 if (fpu_state_owner == (tsk)) \
40 fpu_save(&tsk->thread.fpu_state); \
41 preempt_enable(); \
42 } while (0)
44 #define exit_fpu() \
45 do { \
46 struct task_struct *__tsk = current; \
47 preempt_disable(); \
48 if (fpu_state_owner == __tsk) \
49 fpu_state_owner = NULL; \
50 preempt_enable(); \
51 } while (0)
53 #define flush_fpu() \
54 do { \
55 struct task_struct *__tsk = current; \
56 preempt_disable(); \
57 if (fpu_state_owner == __tsk) { \
58 fpu_state_owner = NULL; \
59 __tsk->thread.uregs->epsw &= ~EPSW_FE; \
60 } \
61 preempt_enable(); \
62 clear_using_fpu(__tsk); \
63 } while (0)
65 extern asmlinkage void fpu_init_state(void);
66 extern asmlinkage void fpu_kill_state(struct task_struct *);
67 extern asmlinkage void fpu_disabled(struct pt_regs *, enum exception_code);
68 extern asmlinkage void fpu_exception(struct pt_regs *, enum exception_code);
70 #ifdef CONFIG_FPU
71 extern asmlinkage void fpu_save(struct fpu_state_struct *);
72 extern asmlinkage void fpu_restore(struct fpu_state_struct *);
73 #else
74 #define fpu_save(a)
75 #define fpu_restore(a)
76 #endif /* CONFIG_FPU */
79 * signal frame handlers
81 extern int fpu_setup_sigcontext(struct fpucontext *buf);
82 extern int fpu_restore_sigcontext(struct fpucontext *buf);
84 #endif /* __KERNEL__ */
85 #endif /* _ASM_FPU_H */