xref: /haiku/headers/private/kernel/arch/sparc/arch_thread.h (revision 2ca1376080f866aafba1edc95eaa036b92ed2078)
1 /*
2  * Copyright 2003-2019, 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  * 		Adrien Destugues <pulkomandy@pulkomandy.tk>
9  */
10 #ifndef _KERNEL_ARCH_SPARC_THREAD_H
11 #define _KERNEL_ARCH_SPARC_THREAD_H
12 
13 #include <arch/cpu.h>
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 static inline Thread *
20 arch_thread_get_current_thread(void)
21 {
22     Thread *t;
23     asm volatile("mov %%g7, %0" : "=r"(t));
24     return t;
25 }
26 
27 
28 static inline void
29 arch_thread_set_current_thread(Thread *t)
30 {
31     asm volatile("mov %0,%%g7" : : "r"(t));
32 }
33 
34 
35 #ifdef __cplusplus
36 }
37 #endif
38 
39 
40 #endif /* _KERNEL_ARCH_SPARC_THREAD_H */
41 
42