1 /*
2  * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>
3  *     economic rights: Technische Universität Dresden (Germany)
4  *
5  * This file is part of TUD:OS and distributed under the terms of the
6  * GNU General Public License 2.
7  * Please see the COPYING-GPL-2 file for details.
8  */
9 #pragma once
10 
11 inline void
switch_stack(unsigned long stack,void (* func)())12 switch_stack(unsigned long stack, void (*func)())
13 {
14 //  register unsigned long r3 asm("r3") = 0;
15   asm volatile ( "mr    %%r1, %[stack] \n\t"
16                  "mtctr %[func]        \n\t"
17                  "bctr                 \n\t"
18 		 : : [stack] "r" (stack), [func] "r" (func) //, "r" (r3)
19 		 : "memory", "ctr");
20 }
21 
22