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();
/* 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");
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;
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;
prev_list = NULL;
prevcount = 0;
do {
- int result;
+ int result;
kern_result = task_threads(my_task, &act_list, &listcount);
- result = GC_suspend_thread_list(act_list, listcount,
- prev_list, prevcount);
- changes = result;
- prev_list = act_list;
- prevcount = listcount;
- if(kern_result == KERN_SUCCESS) {
- int i;
+ if(kern_result == KERN_SUCCESS) {
+ result = GC_suspend_thread_list(act_list, listcount,
+ prev_list, prevcount);
+ changes = result;
- for(i = 0; i < listcount; i++)
- mach_port_deallocate(my_task, act_list[i]);
+ if(prev_list != NULL) {
+ for(i = 0; i < prevcount; i++)
+ mach_port_deallocate(my_task, prev_list[i]);
+
+ vm_deallocate(my_task, (vm_address_t)prev_list, sizeof(thread_t) * prevcount);
+ }
- vm_deallocate(my_task, (vm_address_t)act_list, sizeof(thread_t) * listcount);
- }
+ prev_list = act_list;
+ prevcount = listcount;
+ }
} while (changes);
-
+
+ for(i = 0; i < listcount; i++)
+ mach_port_deallocate(my_task, act_list[i]);
+
+ vm_deallocate(my_task, (vm_address_t)act_list, sizeof(thread_t) * listcount);
+
# ifdef MPROTECT_VDB
if(GC_incremental) {