/*1* Copyright (C) 2004-2006 Atmel Corporation2*3* This program is free software; you can redistribute it and/or modify4* it under the terms of the GNU General Public License version 2 as5* published by the Free Software Foundation.6*/78#include <asm/sysreg.h>910.text11.global __switch_to12.type __switch_to, @function1314/* Switch thread context from "prev" to "next", returning "last"15* r12 : prev16* r11 : &prev->thread + 117* r10 : &next->thread18*/19__switch_to:20stm --r11, r0,r1,r2,r3,r4,r5,r6,r7,sp,lr21mfsr r9, SYSREG_SR22st.w --r11, r923ld.w r8, r10++24/*25* schedule() may have been called from a mode with a different26* set of registers. Make sure we don't lose anything here.27*/28pushm r10,r1229mtsr SYSREG_SR, r830frs /* flush the return stack */31sub pc, -2 /* flush the pipeline */32popm r10,r1233ldm r10++, r0,r1,r2,r3,r4,r5,r6,r7,sp,pc34.size __switch_to, . - __switch_to353637