linux/arch/sh/include/asm/fpu.h
<<
>>
Prefs
   1#ifndef __ASM_SH_FPU_H
   2#define __ASM_SH_FPU_H
   3
   4#ifndef __ASSEMBLY__
   5
   6struct task_struct;
   7
   8#ifdef CONFIG_SH_FPU
   9static inline void release_fpu(struct pt_regs *regs)
  10{
  11        regs->sr |= SR_FD;
  12}
  13
  14static inline void grab_fpu(struct pt_regs *regs)
  15{
  16        regs->sr &= ~SR_FD;
  17}
  18
  19extern void save_fpu(struct task_struct *__tsk);
  20extern void restore_fpu(struct task_struct *__tsk);
  21extern void fpu_state_restore(struct pt_regs *regs);
  22extern void __fpu_state_restore(void);
  23#else
  24#define save_fpu(tsk)                   do { } while (0)
  25#define restore_fpu(tsk)                do { } while (0)
  26#define release_fpu(regs)               do { } while (0)
  27#define grab_fpu(regs)                  do { } while (0)
  28#define fpu_state_restore(regs)         do { } while (0)
  29#define __fpu_state_restore(regs)       do { } while (0)
  30#endif
  31
  32struct user_regset;
  33
  34extern int do_fpu_inst(unsigned short, struct pt_regs *);
  35extern int init_fpu(struct task_struct *);
  36
  37extern int fpregs_get(struct task_struct *target,
  38                      const struct user_regset *regset,
  39                      unsigned int pos, unsigned int count,
  40                      void *kbuf, void __user *ubuf);
  41
  42static inline void __unlazy_fpu(struct task_struct *tsk, struct pt_regs *regs)
  43{
  44        if (task_thread_info(tsk)->status & TS_USEDFPU) {
  45                task_thread_info(tsk)->status &= ~TS_USEDFPU;
  46                save_fpu(tsk);
  47                release_fpu(regs);
  48        } else
  49                tsk->thread.fpu_counter = 0;
  50}
  51
  52static inline void unlazy_fpu(struct task_struct *tsk, struct pt_regs *regs)
  53{
  54        preempt_disable();
  55        __unlazy_fpu(tsk, regs);
  56        preempt_enable();
  57}
  58
  59static inline void clear_fpu(struct task_struct *tsk, struct pt_regs *regs)
  60{
  61        preempt_disable();
  62        if (task_thread_info(tsk)->status & TS_USEDFPU) {
  63                task_thread_info(tsk)->status &= ~TS_USEDFPU;
  64                release_fpu(regs);
  65        }
  66        preempt_enable();
  67}
  68
  69#endif /* __ASSEMBLY__ */
  70
  71#endif /* __ASM_SH_FPU_H */
  72