Phoenix
Object-oriented orthogonally persistent operating system
|
00001 /* 00002 * /phoenix/kernel/sys/arch/x86_64/md_stack.h 00003 * 00004 * This file is a part of Phoenix operating system. 00005 * Copyright (c) 2011-2012, Artyom Lebedev <artyom.lebedev@gmail.com> 00006 * All rights reserved. 00007 * See COPYING file for copyright details. 00008 */ 00009 00014 #ifndef MD_STACK_H_ 00015 #define MD_STACK_H_ 00016 00017 namespace { 00018 00024 typedef void (*StackEntryFunc)(void *arg) __NORETURN; 00025 00038 inline void SwitchStack(vaddr_t stackAddr, StackEntryFunc entryFunc, void *arg) 00039 __NORETURN; 00040 inline void 00041 SwitchStack(vaddr_t stackAddr, StackEntryFunc entryFunc, void *arg = 0) 00042 { 00043 ASM ( 00044 "movq %[stackAddr], %%rsp\n" 00045 "jmp *%[entryFunc]\n" 00046 : 00047 : [arg]"D"(arg), [entryFunc]"a"(entryFunc), [stackAddr]"S"(stackAddr) 00048 : "memory" 00049 ); 00050 NOT_REACHED(); 00051 } 00052 00053 } /* anonymous namespace */ 00054 00055 #endif /* MD_STACK_H_ */