xref: /haiku/headers/private/kernel/arch/thread.h (revision a381c8a06378de22ff08adf4282b4e3f7e50d250)
1 /*
2  * Copyright 2002-2007, Axel Dörfler, axeld@pinc-software.de.
3  * Distributed under the terms of the MIT 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 
12 #include <thread_types.h>
13 
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 status_t arch_thread_init(struct kernel_args *args);
20 status_t arch_team_init_team_struct(struct team *t, bool kernel);
21 status_t arch_thread_init_thread_struct(struct thread *t);
22 status_t arch_thread_init_tls(struct thread *thread);
23 void arch_thread_context_switch(struct thread *t_from, struct thread *t_to);
24 status_t arch_thread_init_kthread_stack(struct thread *t,
25 	int (*start_func)(void), void (*entry_func)(void), void (*exit_func)(void));
26 void arch_thread_dump_info(void *info);
27 status_t arch_thread_enter_userspace(struct thread *t, addr_t entry,
28 	void *args1, void *args2);
29 void arch_thread_switch_kstack_and_call(struct thread *t, addr_t new_kstack,
30 	void (*func)(void *), void *arg);
31 
32 // ToDo: doing this this way is an ugly hack - please fix me!
33 //		(those functions are "static inline" for x86 - since
34 //		"extern inline" doesn't work for "gcc -g"...)
35 #ifndef ARCH_x86
36 struct thread *arch_thread_get_current_thread(void);
37 void arch_thread_set_current_thread(struct thread *t);
38 #endif
39 
40 bool arch_on_signal_stack(struct thread *thread);
41 status_t arch_setup_signal_frame(struct thread *t, struct sigaction *sa,
42 	int signal, int signalMask);
43 int64 arch_restore_signal_frame(void);
44 
45 void arch_store_fork_frame(struct arch_fork_arg *arg);
46 void arch_restore_fork_frame(struct arch_fork_arg *arg);
47 
48 #define arch_syscall_64_bit_return_value()
49 	// overridden by architectures that need special handling
50 
51 #ifdef __cplusplus
52 }
53 #endif
54 
55 // for any inline overrides
56 #include <arch_thread.h>
57 
58 #endif	/* KERNEL_ARCH_THREAD_H */
59