ABORT("thread_get_state failed");
# if defined(I386)
- lo = (void *)state.THREAD_FLD(esp);
+ lo = (ptr_t)state.THREAD_FLD(esp);
# ifndef DARWIN_DONT_PARSE_STACK
*phi = GC_FindTopOfStack(state.THREAD_FLD(esp));
# endif
GC_push_one(state.THREAD_FLD(ebp));
# elif defined(X86_64)
- lo = (void *)state.THREAD_FLD(rsp);
+ lo = (ptr_t)state.THREAD_FLD(rsp);
# ifndef DARWIN_DONT_PARSE_STACK
*phi = GC_FindTopOfStack(state.THREAD_FLD(rsp));
# endif
GC_push_one(state.THREAD_FLD(r15));
# elif defined(POWERPC)
- lo = (void *)(state.THREAD_FLD(r1) - PPC_RED_ZONE_SIZE);
+ lo = (ptr_t)(state.THREAD_FLD(r1) - PPC_RED_ZONE_SIZE);
# ifndef DARWIN_DONT_PARSE_STACK
*phi = GC_FindTopOfStack(state.THREAD_FLD(r1));
# endif
GC_push_one(state.THREAD_FLD(r31));
# elif defined(ARM32)
- lo = (void *)state.THREAD_FLD(sp);
+ lo = (ptr_t)state.THREAD_FLD(sp);
# ifndef DARWIN_DONT_PARSE_STACK
*phi = GC_FindTopOfStack(state.THREAD_FLD(r[7])); /* fp */
# endif
GC_push_one(state.THREAD_FLD(lr));
# elif defined(AARCH64)
- lo = (void *)state.THREAD_FLD(sp);
+ lo = (ptr_t)state.THREAD_FLD(sp);
# ifndef DARWIN_DONT_PARSE_STACK
*phi = GC_FindTopOfStack(state.THREAD_FLD(fp));
# endif
# include "mm/PCR_MM.h"
#endif
+#if defined(GC_DARWIN_THREADS) && defined(MPROTECT_VDB)
+ /* Declare GC_mprotect_stop and GC_mprotect_resume as extern "C". */
+# include "private/darwin_stop_world.h"
+#endif
+
#if !defined(NO_EXECUTE_PERMISSION)
STATIC GC_bool GC_pages_executable = TRUE;
#else
#include <mach/task.h>
#include <pthread.h>
-/* These are not defined in any header, although they are documented */
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* Some of the following prototypes are missing in any header, although */
+/* they are documented. Some are in mach/exc.h file. */
extern boolean_t
exc_server(mach_msg_header_t *, mach_msg_header_t *);
GC_API_OSCALL kern_return_t
catch_exception_raise(mach_port_t exception_port, mach_port_t thread,
mach_port_t task, exception_type_t exception,
- exception_data_t code, mach_msg_type_number_t code_count);
+ exception_data_t code,
+ mach_msg_type_number_t code_count);
+
+GC_API_OSCALL kern_return_t
+catch_exception_raise_state(mach_port_name_t exception_port,
+ int exception, exception_data_t code,
+ mach_msg_type_number_t codeCnt, int flavor,
+ thread_state_t old_state, int old_stateCnt,
+ thread_state_t new_state, int new_stateCnt);
+
+GC_API_OSCALL kern_return_t
+catch_exception_raise_state_identity(mach_port_name_t exception_port,
+ mach_port_t thread, mach_port_t task, int exception,
+ exception_data_t code, mach_msg_type_number_t codeCnt,
+ int flavor, thread_state_t old_state, int old_stateCnt,
+ thread_state_t new_state, int new_stateCnt);
+
+#ifdef __cplusplus
+ } /* extern "C" */
+#endif
/* These should never be called, but just in case... */
GC_API_OSCALL kern_return_t
/* This value is only used on the reply port. */
# define ID_ACK 3
- STATIC GC_mprotect_state_t GC_mprotect_state = 0;
+ STATIC GC_mprotect_state_t GC_mprotect_state = GC_MP_NORMAL;
/* The following should ONLY be called when the world is stopped. */
STATIC void GC_mprotect_thread_notify(mach_msg_id_t id)