summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Hsu <allan@counterpop.net>2006-11-19 16:42:26 +0000
committerIvan Maidanski <ivmai@mail.ru>2011-07-28 11:57:48 +0400
commitee085e67e7702ae67883e7c2bb6f7c228f79d513 (patch)
treeee874c4b71827df114514006707fbbea72f58472
parenta98c300ba12dfc1d5321ad9f72186cb77192cfaf (diff)
downloadbdwgc-ee085e67e7702ae67883e7c2bb6f7c228f79d513.tar.gz
Fix OSX/Intel support with SDK 10.4
- libgc/darwin_stop_world.c, libgc/include/private/gc_priv.h, libgc/os_dep.c: Fixes to make the GC work on OSX/Intel with XCode 2.4 (10.4u SDK and newer). This code should work with older versions of the SDK as well. Ported from Mono revision 68156.
-rw-r--r--darwin_stop_world.c11
-rw-r--r--include/private/gc_priv.h10
-rw-r--r--os_dep.c2
3 files changed, 18 insertions, 5 deletions
diff --git a/darwin_stop_world.c b/darwin_stop_world.c
index ae79bb96..462140af 100644
--- a/darwin_stop_world.c
+++ b/darwin_stop_world.c
@@ -77,14 +77,17 @@ void GC_push_all_stacks() {
ptr_t lo, hi;
#if defined(POWERPC)
ppc_thread_state_t state;
+ mach_msg_type_number_t thread_state_count = PPC_THREAD_STATE_COUNT;
#elif defined(I386)
i386_thread_state_t state;
+ mach_msg_type_number_t thread_state_count = i386_THREAD_STATE_COUNT;
#elif defined(ARM)
arm_thread_state_t state;
+ mach_msg_type_number_t thread_state_count = ARM_THREAD_STATE_COUNT;
#else
# error FIXME for non-x86 || ppc architectures
-#endif
mach_msg_type_number_t thread_state_count = MACHINE_THREAD_STATE_COUNT;
+#endif
me = pthread_self();
if (!GC_thr_initialized) GC_thr_init();
@@ -98,7 +101,7 @@ void GC_push_all_stacks() {
/* Get the thread state (registers, etc) */
r = thread_get_state(
p->stop_info.mach_thread,
- MACHINE_THREAD_STATE,
+ GC_MACH_THREAD_STATE_FLAVOR,
(natural_t*)&state,
&thread_state_count);
if(r != KERN_SUCCESS) ABORT("thread_get_state failed");
@@ -265,7 +268,7 @@ void GC_push_all_stacks() {
ppc_thread_state64_t info;
# endif
mach_msg_type_number_t outCount = THREAD_STATE_MAX;
- r = thread_get_state(thread, MACHINE_THREAD_STATE,
+ r = thread_get_state(thread, GC_MACH_THREAD_STATE_FLAVOR,
(natural_t *)&info, &outCount);
if(r != KERN_SUCCESS) ABORT("task_get_state failed");
@@ -345,7 +348,7 @@ void GC_push_all_stacks() {
WARN("This is completely untested and likely will not work\n", 0);
i386_thread_state_t info;
mach_msg_type_number_t outCount = THREAD_STATE_MAX;
- r = thread_get_state(thread, MACHINE_THREAD_STATE,
+ r = thread_get_state(thread, GC_MACH_THREAD_STATE_FLAVOR,
(natural_t *)&info, &outCount);
if(r != KERN_SUCCESS) ABORT("task_get_state failed");
diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h
index 2abd27dd..b1e361f9 100644
--- a/include/private/gc_priv.h
+++ b/include/private/gc_priv.h
@@ -365,6 +365,16 @@ void GC_print_callers GC_PROTO((struct callinfo info[NFRAMES]));
# define BZERO(x,n) bzero((char *)(x),(int)(n))
# endif
+#if defined(DARWIN)
+# if defined(POWERPC)
+# define GC_MACH_THREAD_STATE_FLAVOR PPC_THREAD_STATE
+# elif defined(I386)
+# define GC_MACH_THREAD_STATE_FLAVOR i386_THREAD_STATE
+# else
+# define GC_MACH_THREAD_STATE_FLAVOR MACHINE_THREAD_STATE
+# endif
+#endif
+
/* Delay any interrupts or signals that may abort this thread. Data */
/* structures are in a consistent state outside this pair of calls. */
/* ANSI C allows both to be empty (though the standard isn't very */
diff --git a/os_dep.c b/os_dep.c
index c9396f5a..a35f11fa 100644
--- a/os_dep.c
+++ b/os_dep.c
@@ -3690,7 +3690,7 @@ void GC_dirty_init() {
mask,
GC_ports.exception,
EXCEPTION_DEFAULT,
- MACHINE_THREAD_STATE
+ GC_MACH_THREAD_STATE_FLAVOR
);
if(r != KERN_SUCCESS) ABORT("task_set_exception_ports failed");