55fd9850fc27e64d3ccbc43a4f96cb697cccbf40
[mono.git] / mono / utils / mach-support.h
1 #ifndef __MONO_MACH_SUPPORT_H__
2 #define __MONO_MACH_SUPPORT_H__
3
4 #include "config.h"
5 #if defined(__MACH__)
6 #include <glib.h>
7 #include <pthread.h>
8 #include "mono/utils/mono-compiler.h"
9 #include <mach/task.h>
10 #include <mach/mach_port.h>
11 #include <mach/mach_init.h>
12 #include <mach/thread_act.h>
13 #include <mach/thread_status.h>
14
15 #define MONO_MACH_ARCH_SUPPORTED 1
16 #if defined(__arm__)
17 typedef _STRUCT_MCONTEXT *mcontext_t;
18 #endif
19
20 // We need to define this here since we need _XOPEN_SOURCE for mono
21 // and the pthread header guards against this
22 extern pthread_t pthread_from_mach_thread_np(mach_port_t);
23
24 void *mono_mach_arch_get_ip (thread_state_t state) MONO_INTERNAL;
25 void *mono_mach_arch_get_sp (thread_state_t state) MONO_INTERNAL;
26 void mono_mach_init (pthread_key_t key) MONO_INTERNAL;
27
28 int mono_mach_arch_get_mcontext_size (void) MONO_INTERNAL;
29 void mono_mach_arch_thread_state_to_mcontext (thread_state_t state, void *context) MONO_INTERNAL;
30 void mono_mach_arch_mcontext_to_thread_state (void *context, thread_state_t state) MONO_INTERNAL;
31
32 int mono_mach_arch_get_thread_state_size (void) MONO_INTERNAL;
33 kern_return_t mono_mach_get_threads (thread_act_array_t *threads, guint32 *count) MONO_INTERNAL;
34 kern_return_t mono_mach_free_threads (thread_act_array_t threads, guint32 count) MONO_INTERNAL;
35 kern_return_t mono_mach_arch_get_thread_state (thread_port_t thread, thread_state_t state, mach_msg_type_number_t *count) MONO_INTERNAL;
36 kern_return_t mono_mach_arch_set_thread_state (thread_port_t thread, thread_state_t state, mach_msg_type_number_t count) MONO_INTERNAL;
37 void *mono_mach_arch_get_tls_value_from_thread (pthread_t thread, guint32 key) MONO_INTERNAL;
38 void *mono_mach_get_tls_address_from_thread (pthread_t thread, pthread_key_t key) MONO_INTERNAL;
39
40 #endif
41 #endif /* __MONO_MACH_SUPPORT_H__ */