/*1* Copyright (C) 2004 Microtronix Datacom Ltd.2*3* This file is subject to the terms and conditions of the GNU General Public4* License. See the file "COPYING" in the main directory of this archive5* for more details.6*/7#ifndef _ASM_NIOS2_SWITCH_TO_H8#define _ASM_NIOS2_SWITCH_TO_H910/*11* switch_to(n) should switch tasks to task ptr, first checking that12* ptr isn't the current task, in which case it does nothing. This13* also clears the TS-flag if the task we switched to has used the14* math co-processor latest.15*/16#define switch_to(prev, next, last) \17{ \18void *_last; \19__asm__ __volatile__ ( \20"mov r4, %1\n" \21"mov r5, %2\n" \22"call resume\n" \23"mov %0,r4\n" \24: "=r" (_last) \25: "r" (prev), "r" (next) \26: "r4", "r5", "r7", "r8", "ra"); \27(last) = _last; \28}2930#endif /* _ASM_NIOS2_SWITCH_TO_H */313233