xref: /openbmc/linux/arch/arc/include/asm/switch_to.h (revision dc6a81c3)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
4  */
5 
6 #ifndef _ASM_ARC_SWITCH_TO_H
7 #define _ASM_ARC_SWITCH_TO_H
8 
9 #ifndef __ASSEMBLY__
10 
11 #include <linux/sched.h>
12 #include <asm/fpu.h>
13 
14 #ifdef CONFIG_ARC_PLAT_EZNPS
15 extern void dp_save_restore(struct task_struct *p, struct task_struct *n);
16 #define ARC_EZNPS_DP_PREV(p, n)      dp_save_restore(p, n)
17 #else
18 #define ARC_EZNPS_DP_PREV(p, n)
19 
20 #endif /* !CONFIG_ARC_PLAT_EZNPS */
21 
22 struct task_struct *__switch_to(struct task_struct *p, struct task_struct *n);
23 
24 #define switch_to(prev, next, last)	\
25 do {					\
26 	ARC_EZNPS_DP_PREV(prev, next);	\
27 	fpu_save_restore(prev, next);	\
28 	last = __switch_to(prev, next);\
29 	mb();				\
30 } while (0)
31 
32 #endif
33 
34 #endif
35