xref: /haiku/headers/private/kernel/arch/x86/arch_thread.h (revision a6e73cb9e8addfe832c064bfcb68067f1c2fa3eb)
1 /*
2  * Copyright 2002-2011, The Haiku Team. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Copyright 2002, Travis Geiselbrecht. All rights reserved.
6  * Distributed under the terms of the NewOS License.
7  */
8 #ifndef _KERNEL_ARCH_x86_THREAD_H
9 #define _KERNEL_ARCH_x86_THREAD_H
10 
11 
12 #include <arch/cpu.h>
13 
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 struct iframe *i386_get_user_iframe(void);
20 struct iframe *i386_get_current_iframe(void);
21 struct iframe *i386_get_thread_user_iframe(Thread *thread);
22 
23 uint32 x86_next_page_directory(Thread *from, Thread *to);
24 
25 void x86_restart_syscall(struct iframe* frame);
26 
27 // override empty macro
28 #undef arch_syscall_64_bit_return_value
29 void arch_syscall_64_bit_return_value(void);
30 
31 
32 static
33 inline Thread *
34 arch_thread_get_current_thread(void)
35 {
36 	Thread *t;
37 	read_dr3(t);
38 	return t;
39 }
40 
41 static inline void
42 arch_thread_set_current_thread(Thread *t)
43 {
44 	write_dr3(t);
45 }
46 
47 #ifdef __cplusplus
48 }
49 #endif
50 
51 #endif /* _KERNEL_ARCH_x86_THREAD_H */
52 
53