1/*
2 * Copyright 2003-2011, 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
15extern "C" {
16#endif
17
18void ppc_push_iframe(struct iframe_stack *stack, struct iframe *frame);
19void ppc_pop_iframe(struct iframe_stack *stack);
20struct iframe *ppc_get_user_iframe(void);
21
22
23static inline Thread *
24arch_thread_get_current_thread(void)
25{
26    Thread *t;
27    asm volatile("mfsprg2 %0" : "=r"(t));
28    return t;
29}
30
31
32static inline void
33arch_thread_set_current_thread(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