column name and ordinal fix...tested on 10.1
[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 "mono/utils/mono-context.h"
10 #include <mach/task.h>
11 #include <mach/mach_port.h>
12 #include <mach/mach_init.h>
13 #include <mach/thread_act.h>
14 #include <mach/thread_status.h>
15
16 #define MONO_MACH_ARCH_SUPPORTED 1
17 #if defined(__arm__)
18 typedef _STRUCT_MCONTEXT *mcontext_t;
19 #elif defined(__aarch64__)
20 typedef _STRUCT_MCONTEXT64 *mcontext_t;
21 #endif
22
23 // We need to define this here since we need _XOPEN_SOURCE for mono
24 // and the pthread header guards against this
25 extern pthread_t pthread_from_mach_thread_np(mach_port_t);
26
27 void *mono_mach_arch_get_ip (thread_state_t state);
28 void *mono_mach_arch_get_sp (thread_state_t state);
29 void mono_mach_init (pthread_key_t key);
30
31 int mono_mach_arch_get_mcontext_size (void);
32 void mono_mach_arch_thread_state_to_mcontext (thread_state_t state, void *context);
33 void mono_mach_arch_mcontext_to_thread_state (void *context, thread_state_t state);
34 void mono_mach_arch_thread_state_to_mono_context (thread_state_t state, MonoContext *context);
35
36 int mono_mach_arch_get_thread_state_size (void);
37 kern_return_t mono_mach_get_threads (thread_act_array_t *threads, guint32 *count);
38 kern_return_t mono_mach_free_threads (thread_act_array_t threads, guint32 count);
39 kern_return_t mono_mach_arch_get_thread_state (thread_port_t thread, thread_state_t state, mach_msg_type_number_t *count);
40 kern_return_t mono_mach_arch_set_thread_state (thread_port_t thread, thread_state_t state, mach_msg_type_number_t count);
41 void *mono_mach_arch_get_tls_value_from_thread (pthread_t thread, guint32 key);
42 void *mono_mach_get_tls_address_from_thread (pthread_t thread, pthread_key_t key);
43
44 #endif
45 #endif /* __MONO_MACH_SUPPORT_H__ */