2006-11-19 Allan Hsu <allan@counterpop.net>
authorMiguel de Icaza <miguel@gnome.org>
Sun, 19 Nov 2006 16:42:26 +0000 (16:42 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Sun, 19 Nov 2006 16:42:26 +0000 (16:42 -0000)
* 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.

svn path=/trunk/mono/; revision=68156

libgc/ChangeLog
libgc/darwin_stop_world.c
libgc/include/private/gc_priv.h
libgc/os_dep.c

index 06ed8152122af4657254e207508d192253cb3a18..d9a9a5d98eccd13046cf56a62da71c61f984d21a 100644 (file)
@@ -1,3 +1,10 @@
+2006-11-19  Allan Hsu <allan@counterpop.net>
+
+       * 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. 
 
 Tue Oct 10 16:58:37 CEST 2006 Paolo Molaro <lupus@ximian.com>
 
index 00a25cf62d24bda6185917df2c755d27fac807cd..04bb415e02624dafba3620141fa0810a05a7dbbf 100644 (file)
@@ -75,12 +75,14 @@ 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;
 #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();
@@ -94,7 +96,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");
@@ -193,7 +195,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) continue;
 
@@ -236,7 +238,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) continue;
 
index 6cb6a8991a862c9cd385b28fc9c27da8031d2d08..cc0410d441f6955906f8473fa971ed76224ebc98 100644 (file)
@@ -366,6 +366,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      */
index e92a9ef636c4ec2dbdb32a3109696df383c6d5f2..f64caeffa2f0257a77a8a29340b5864a3d4e7a7a 100644 (file)
@@ -3702,7 +3702,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");