xref: /haiku/headers/private/kernel/arch/m68k/arch_thread.h (revision 6e927a5fc080cb934e7584454f472cacf4c3e361)
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_M68K_THREAD_H
10 #define _KERNEL_ARCH_M68K_THREAD_H
11 
12 #include <arch/cpu.h>
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 void m68k_push_iframe(struct iframe_stack *stack, struct iframe *frame);
19 void m68k_pop_iframe(struct iframe_stack *stack);
20 struct iframe *m68k_get_user_iframe(void);
21 
22 
23 extern inline struct thread *
24 arch_thread_get_current_thread(void)
25 {
26 	uint64 v = 0;
27 	asm volatile("pmove %%srp,(%0)" : : "a"(&v));
28 	return (struct thread *)(uint32)(v & 0xffffffff);
29 }
30 
31 
32 extern inline void
33 arch_thread_set_current_thread(struct thread *t)
34 {
35 	uint64 v;
36 	asm volatile("pmove %%srp,(%0)\n" \
37 			"move %1,(4,%0)\n" \
38 			"pmove (%0),%%srp" : : "a"(&v), "d"(t));
39 }
40 
41 
42 #ifdef __cplusplus
43 }
44 #endif
45 
46 
47 #endif /* _KERNEL_ARCH_M68K_THREAD_H */
48