xref: /haiku/headers/private/kernel/arch/thread.h (revision 39241fe22890fb958b6ba32d6ab9526da98be187)
1 /*
2 ** Copyright 2002-2004, The Haiku Team. All rights reserved.
3 ** Distributed under the terms of the Haiku License.
4 **
5 ** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
6 ** Distributed under the terms of the NewOS License.
7 */
8 #ifndef KERNEL_ARCH_THREAD_H
9 #define KERNEL_ARCH_THREAD_H
10 
11 #include <thread.h>
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 status_t arch_thread_init(struct kernel_args *args);
18 status_t arch_team_init_team_struct(struct team *t, bool kernel);
19 status_t arch_thread_init_thread_struct(struct thread *t);
20 void arch_thread_init_tls(struct thread *thread);
21 void arch_thread_context_switch(struct thread *t_from, struct thread *t_to);
22 status_t arch_thread_init_kthread_stack(struct thread *t, int (*start_func)(void), void (*entry_func)(void), void (*exit_func)(void));
23 void arch_thread_dump_info(void *info);
24 void arch_thread_enter_uspace(struct thread *t, addr_t entry, void *args1, void *args2);
25 void arch_thread_switch_kstack_and_call(struct thread *t, addr_t new_kstack, void (*func)(void *), void *arg);
26 
27 // ToDo: doing this this way is an ugly hack - please fix me!
28 //		(those functions are "static inline" for x86 - since
29 //		"extern inline" doesn't work for "gcc -g"...)
30 #ifndef ARCH_x86
31 struct thread *arch_thread_get_current_thread(void);
32 void arch_thread_set_current_thread(struct thread *t);
33 #endif
34 
35 status_t arch_setup_signal_frame(struct thread *t, struct sigaction *sa, int sig, int sig_mask);
36 int64 arch_restore_signal_frame(void);
37 void arch_check_syscall_restart(struct thread *t);
38 
39 void arch_store_fork_frame(struct arch_fork_arg *arg);
40 void arch_restore_fork_frame(struct arch_fork_arg *arg);
41 
42 // for any inline overrides
43 #include <arch_thread.h>
44 
45 #ifdef __cplusplus
46 }
47 #endif
48 
49 #endif	/* KERNEL_ARCH_THREAD_H */
50