~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/mn10300/include/asm/fpu.h

Version: ~ [ linux-5.3-rc5 ] ~ [ linux-5.2.9 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.67 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.139 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.189 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.189 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.72 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* MN10300 FPU definitions
  2  *
  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
  6  *
  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.
 11  */
 12 #ifndef _ASM_FPU_H
 13 #define _ASM_FPU_H
 14 
 15 #ifndef __ASSEMBLY__
 16 
 17 #include <linux/sched.h>
 18 #include <asm/exceptions.h>
 19 #include <asm/sigcontext.h>
 20 
 21 #ifdef __KERNEL__
 22 
 23 extern asmlinkage void fpu_disabled(void);
 24 
 25 #ifdef CONFIG_FPU
 26 
 27 #ifdef CONFIG_LAZY_SAVE_FPU
 28 /* the task that currently owns the FPU state */
 29 extern struct task_struct *fpu_state_owner;
 30 #endif
 31 
 32 #if (THREAD_USING_FPU & ~0xff)
 33 #error THREAD_USING_FPU must be smaller than 0x100.
 34 #endif
 35 
 36 static inline void set_using_fpu(struct task_struct *tsk)
 37 {
 38         asm volatile(
 39                 "bset %0,(0,%1)"
 40                 :
 41                 : "i"(THREAD_USING_FPU), "a"(&tsk->thread.fpu_flags)
 42                 : "memory", "cc");
 43 }
 44 
 45 static inline void clear_using_fpu(struct task_struct *tsk)
 46 {
 47         asm volatile(
 48                 "bclr %0,(0,%1)"
 49                 :
 50                 : "i"(THREAD_USING_FPU), "a"(&tsk->thread.fpu_flags)
 51                 : "memory", "cc");
 52 }
 53 
 54 #define is_using_fpu(tsk) ((tsk)->thread.fpu_flags & THREAD_USING_FPU)
 55 
 56 extern asmlinkage void fpu_kill_state(struct task_struct *);
 57 extern asmlinkage void fpu_exception(struct pt_regs *, enum exception_code);
 58 extern asmlinkage void fpu_init_state(void);
 59 extern asmlinkage void fpu_save(struct fpu_state_struct *);
 60 extern int fpu_setup_sigcontext(struct fpucontext *buf);
 61 extern int fpu_restore_sigcontext(struct fpucontext *buf);
 62 
 63 static inline void unlazy_fpu(struct task_struct *tsk)
 64 {
 65         preempt_disable();
 66 #ifndef CONFIG_LAZY_SAVE_FPU
 67         if (tsk->thread.fpu_flags & THREAD_HAS_FPU) {
 68                 fpu_save(&tsk->thread.fpu_state);
 69                 tsk->thread.fpu_flags &= ~THREAD_HAS_FPU;
 70                 tsk->thread.uregs->epsw &= ~EPSW_FE;
 71         }
 72 #else
 73         if (fpu_state_owner == tsk)
 74                 fpu_save(&tsk->thread.fpu_state);
 75 #endif
 76         preempt_enable();
 77 }
 78 
 79 static inline void exit_fpu(void)
 80 {
 81 #ifdef CONFIG_LAZY_SAVE_FPU
 82         struct task_struct *tsk = current;
 83 
 84         preempt_disable();
 85         if (fpu_state_owner == tsk)
 86                 fpu_state_owner = NULL;
 87         preempt_enable();
 88 #endif
 89 }
 90 
 91 static inline void flush_fpu(void)
 92 {
 93         struct task_struct *tsk = current;
 94 
 95         preempt_disable();
 96 #ifndef CONFIG_LAZY_SAVE_FPU
 97         if (tsk->thread.fpu_flags & THREAD_HAS_FPU) {
 98                 tsk->thread.fpu_flags &= ~THREAD_HAS_FPU;
 99                 tsk->thread.uregs->epsw &= ~EPSW_FE;
100         }
101 #else
102         if (fpu_state_owner == tsk) {
103                 fpu_state_owner = NULL;
104                 tsk->thread.uregs->epsw &= ~EPSW_FE;
105         }
106 #endif
107         preempt_enable();
108         clear_using_fpu(tsk);
109 }
110 
111 #else /* CONFIG_FPU */
112 
113 extern asmlinkage
114 void unexpected_fpu_exception(struct pt_regs *, enum exception_code);
115 #define fpu_exception unexpected_fpu_exception
116 
117 struct task_struct;
118 struct fpu_state_struct;
119 static inline bool is_using_fpu(struct task_struct *tsk) { return false; }
120 static inline void set_using_fpu(struct task_struct *tsk) {}
121 static inline void clear_using_fpu(struct task_struct *tsk) {}
122 static inline void fpu_init_state(void) {}
123 static inline void fpu_save(struct fpu_state_struct *s) {}
124 static inline void fpu_kill_state(struct task_struct *tsk) {}
125 static inline void unlazy_fpu(struct task_struct *tsk) {}
126 static inline void exit_fpu(void) {}
127 static inline void flush_fpu(void) {}
128 static inline int fpu_setup_sigcontext(struct fpucontext *buf) { return 0; }
129 static inline int fpu_restore_sigcontext(struct fpucontext *buf) { return 0; }
130 #endif /* CONFIG_FPU  */
131 
132 #endif /* __KERNEL__ */
133 #endif /* !__ASSEMBLY__ */
134 #endif /* _ASM_FPU_H */
135 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp