Guan Xuetao | 8978bfd | 2012-03-28 18:30:03 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Task switching for PKUnity SoC and UniCore ISA |
| 3 | * |
| 4 | * Copyright (C) 2001-2012 GUAN Xue-tao |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as |
| 8 | * published by the Free Software Foundation. |
| 9 | */ |
| 10 | #ifndef __UNICORE_SWITCH_TO_H__ |
| 11 | #define __UNICORE_SWITCH_TO_H__ |
| 12 | |
| 13 | struct task_struct; |
| 14 | struct thread_info; |
| 15 | |
| 16 | /* |
| 17 | * switch_to(prev, next) should switch from task `prev' to `next' |
| 18 | * `prev' will never be the same as `next'. schedule() itself |
| 19 | * contains the memory barrier to tell GCC not to cache `current'. |
| 20 | */ |
| 21 | extern struct task_struct *__switch_to(struct task_struct *, |
| 22 | struct thread_info *, struct thread_info *); |
| 23 | |
| 24 | #define switch_to(prev, next, last) \ |
| 25 | do { \ |
| 26 | last = __switch_to(prev, task_thread_info(prev), \ |
| 27 | task_thread_info(next)); \ |
| 28 | } while (0) |
| 29 | |
| 30 | #endif /* __UNICORE_SWITCH_TO_H__ */ |