mtd: nand: omap: Fix comment in platform data using wrong Kconfig symbol
[linux/fpc-iii.git] / arch / riscv / include / asm / switch_to.h
blob733559083f24bf89fd67e5a7ff64061140eda021
1 /*
2 * Copyright (C) 2012 Regents of the University of California
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation, version 2.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
14 #ifndef _ASM_RISCV_SWITCH_TO_H
15 #define _ASM_RISCV_SWITCH_TO_H
17 #include <asm/processor.h>
18 #include <asm/ptrace.h>
19 #include <asm/csr.h>
21 #ifdef CONFIG_FPU
22 extern void __fstate_save(struct task_struct *save_to);
23 extern void __fstate_restore(struct task_struct *restore_from);
25 static inline void __fstate_clean(struct pt_regs *regs)
27 regs->sstatus |= (regs->sstatus & ~(SR_FS)) | SR_FS_CLEAN;
30 static inline void fstate_save(struct task_struct *task,
31 struct pt_regs *regs)
33 if ((regs->sstatus & SR_FS) == SR_FS_DIRTY) {
34 __fstate_save(task);
35 __fstate_clean(regs);
39 static inline void fstate_restore(struct task_struct *task,
40 struct pt_regs *regs)
42 if ((regs->sstatus & SR_FS) != SR_FS_OFF) {
43 __fstate_restore(task);
44 __fstate_clean(regs);
48 static inline void __switch_to_aux(struct task_struct *prev,
49 struct task_struct *next)
51 struct pt_regs *regs;
53 regs = task_pt_regs(prev);
54 if (unlikely(regs->sstatus & SR_SD))
55 fstate_save(prev, regs);
56 fstate_restore(next, task_pt_regs(next));
59 extern bool has_fpu;
60 #else
61 #define has_fpu false
62 #define fstate_save(task, regs) do { } while (0)
63 #define fstate_restore(task, regs) do { } while (0)
64 #define __switch_to_aux(__prev, __next) do { } while (0)
65 #endif
67 extern struct task_struct *__switch_to(struct task_struct *,
68 struct task_struct *);
70 #define switch_to(prev, next, last) \
71 do { \
72 struct task_struct *__prev = (prev); \
73 struct task_struct *__next = (next); \
74 if (has_fpu) \
75 __switch_to_aux(__prev, __next); \
76 ((last) = __switch_to(__prev, __next)); \
77 } while (0)
79 #endif /* _ASM_RISCV_SWITCH_TO_H */