1 /* 2 * Copyright 2003-2006, Haiku Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Axel Dörfler <axeld@pinc-software.de> 7 * Ingo Weinhold <bonefish@cs.tu-berlin.de> 8 */ 9 #ifndef _KERNEL_ARCH_PPC_THREAD_H 10 #define _KERNEL_ARCH_PPC_THREAD_H 11 12 #include <arch/cpu.h> 13 14 #ifdef __cplusplus 15 extern "C" { 16 #endif 17 18 void ppc_push_iframe(struct iframe_stack *stack, struct iframe *frame); 19 void ppc_pop_iframe(struct iframe_stack *stack); 20 struct iframe *ppc_get_user_iframe(void); 21 22 23 extern inline struct thread * 24 arch_thread_get_current_thread(void) 25 { 26 struct thread *t; 27 asm volatile("mfsprg2 %0" : "=r"(t)); 28 return t; 29 } 30 31 32 extern inline void 33 arch_thread_set_current_thread(struct thread *t) 34 { 35 asm volatile("mtsprg2 %0" : : "r"(t)); 36 } 37 38 39 #ifdef __cplusplus 40 } 41 #endif 42 43 44 #endif /* _KERNEL_ARCH_PPC_THREAD_H */ 45