1 #ifndef __MONO_MACH_SUPPORT_H__
2 #define __MONO_MACH_SUPPORT_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>
16 #define MONO_MACH_ARCH_SUPPORTED 1
18 typedef _STRUCT_MCONTEXT
*mcontext_t
;
19 #elif defined(__aarch64__)
20 typedef _STRUCT_MCONTEXT64
*mcontext_t
;
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
);
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
);
31 int mono_mach_arch_get_mcontext_size (void);
32 void mono_mach_arch_thread_states_to_mcontext (thread_state_t state
, thread_state_t fpstate
, void *context
);
33 void mono_mach_arch_mcontext_to_thread_states (void *context
, thread_state_t state
, thread_state_t fpstate
);
34 void mono_mach_arch_thread_states_to_mono_context (thread_state_t state
, thread_state_t fpstate
, MonoContext
*context
);
36 /* FIXME: Should return size_t, not int. */
37 int mono_mach_arch_get_thread_state_size (void);
38 int mono_mach_arch_get_thread_fpstate_size (void);
39 kern_return_t
mono_mach_get_threads (thread_act_array_t
*threads
, guint32
*count
);
40 kern_return_t
mono_mach_free_threads (thread_act_array_t threads
, guint32 count
);
41 kern_return_t
mono_mach_arch_get_thread_states (thread_port_t thread
, thread_state_t state
, mach_msg_type_number_t
*count
, thread_state_t fpstate
, mach_msg_type_number_t
*fpcount
);
42 kern_return_t
mono_mach_arch_set_thread_states (thread_port_t thread
, thread_state_t state
, mach_msg_type_number_t count
, thread_state_t fpstate
, mach_msg_type_number_t fpcount
);
43 void *mono_mach_arch_get_tls_value_from_thread (pthread_t thread
, guint32 key
);
44 void *mono_mach_get_tls_address_from_thread (pthread_t thread
, pthread_key_t key
);
47 #endif /* __MONO_MACH_SUPPORT_H__ */