thread.h revision c6e120e2
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
16extern "C" {
17#endif
18
19status_t arch_thread_init(struct kernel_args *args);
20status_t arch_team_init_team_struct(Team *t, bool kernel);
21status_t arch_thread_init_thread_struct(Thread *t);
22status_t arch_thread_init_tls(Thread *thread);
23void arch_thread_context_switch(Thread *t_from, Thread *t_to);
24void arch_thread_init_kthread_stack(Thread *thread, void *stack,
25	void *stackTop, void (*function)(void*), const void *data);
26void arch_thread_dump_info(void *info);
27status_t arch_thread_enter_userspace(Thread *t, addr_t entry,
28	void *args1, void *args2);
29
30bool arch_on_signal_stack(Thread *thread);
31status_t arch_setup_signal_frame(Thread *thread, struct sigaction *action,
32	struct signal_frame_data *signalFrameData);
33int64 arch_restore_signal_frame(struct signal_frame_data* signalFrameData);
34#ifdef _COMPAT_MODE
35status_t arch_setup_compat_signal_frame(Thread *thread,
36	struct sigaction *action, struct compat_signal_frame_data *signalFrameData);
37int64 arch_restore_compat_signal_frame(
38	struct compat_signal_frame_data* signalFrameData);
39#endif
40
41void arch_store_fork_frame(struct arch_fork_arg *arg);
42void arch_restore_fork_frame(struct arch_fork_arg *arg);
43
44#define arch_syscall_64_bit_return_value()
45	// overridden by architectures that need special handling
46
47#ifdef __cplusplus
48}
49#endif
50
51// for any inline overrides
52#include <arch_thread.h>
53
54#endif	/* KERNEL_ARCH_THREAD_H */
55