[Mono-dev] [PATCH] OS X MACHINE_THREAD_STATE patch for newer 10.4u SDK
Allan Hsu
allan at counterpop.net
Wed Oct 25 23:22:32 EDT 2006
This patch fixes problems with building mono for i386 using the new
10.4u SDK that ships with Xcode 2.4. Current SVN builds for i386 under
the new SDK, but does not run properly due to changes in
MACHINE_THREAD_STATE. It looks like the breakage in source compatibility
is intentional on Apple's part and future headers will be similarly
broken.
I will be submitting the same patch to libgc upstream.
-Allan
--
Allan Hsu <allan at counterpop dot net>
1E64 E20F 34D9 CBA7 1300 1457 AC37 CBBB 0E92 C779
-------------- next part --------------
Index: libgc/darwin_stop_world.c
===================================================================
--- libgc/darwin_stop_world.c (revision 66738)
+++ libgc/darwin_stop_world.c (working copy)
@@ -75,12 +75,14 @@
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
+ mach_msg_type_number_t thread_state_count = MACHINE_THREAD_STATE_COUNT;
#endif
- mach_msg_type_number_t thread_state_count = MACHINE_THREAD_STATE_COUNT;
me = pthread_self();
if (!GC_thr_initialized) GC_thr_init();
@@ -94,7 +96,7 @@
/* 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 @@
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 @@
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: libgc/include/private/gc_priv.h
===================================================================
--- libgc/include/private/gc_priv.h (revision 66738)
+++ libgc/include/private/gc_priv.h (working copy)
@@ -366,6 +366,16 @@
# 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: libgc/os_dep.c
===================================================================
--- libgc/os_dep.c (revision 66738)
+++ libgc/os_dep.c (working copy)
@@ -3702,7 +3702,7 @@
mask,
GC_ports.exception,
EXCEPTION_DEFAULT,
- MACHINE_THREAD_STATE
+ GC_MACH_THREAD_STATE_FLAVOR
);
if(r != KERN_SUCCESS) ABORT("task_set_exception_ports failed");
More information about the Mono-devel-list
mailing list