xref: /OK3568_Linux_fs/kernel/include/asm-generic/switch_to.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-or-later */
2*4882a593Smuzhiyun /* Generic task switch macro wrapper.
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * It should be possible to use these on really simple architectures,
5*4882a593Smuzhiyun  * but it serves more as a starting point for new ports.
6*4882a593Smuzhiyun  *
7*4882a593Smuzhiyun  * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
8*4882a593Smuzhiyun  * Written by David Howells (dhowells@redhat.com)
9*4882a593Smuzhiyun  */
10*4882a593Smuzhiyun #ifndef __ASM_GENERIC_SWITCH_TO_H
11*4882a593Smuzhiyun #define __ASM_GENERIC_SWITCH_TO_H
12*4882a593Smuzhiyun 
13*4882a593Smuzhiyun #include <linux/thread_info.h>
14*4882a593Smuzhiyun 
15*4882a593Smuzhiyun /*
16*4882a593Smuzhiyun  * Context switching is now performed out-of-line in switch_to.S
17*4882a593Smuzhiyun  */
18*4882a593Smuzhiyun extern struct task_struct *__switch_to(struct task_struct *,
19*4882a593Smuzhiyun 				       struct task_struct *);
20*4882a593Smuzhiyun 
21*4882a593Smuzhiyun #define switch_to(prev, next, last)					\
22*4882a593Smuzhiyun 	do {								\
23*4882a593Smuzhiyun 		((last) = __switch_to((prev), (next)));			\
24*4882a593Smuzhiyun 	} while (0)
25*4882a593Smuzhiyun 
26*4882a593Smuzhiyun #endif /* __ASM_GENERIC_SWITCH_TO_H */
27