#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
mach_msg_type_number_t thread_state_count = MACHINE_THREAD_STATE_COUNT;
GC_push_one(state.r30);
GC_push_one(state.r31);
#endif
+#elif defined(ARM)
+ lo = (void*)state.__sp;
+
+ GC_push_one(state.__r[0]);
+ GC_push_one(state.__r[1]);
+ GC_push_one(state.__r[2]);
+ GC_push_one(state.__r[3]);
+ GC_push_one(state.__r[4]);
+ GC_push_one(state.__r[5]);
+ GC_push_one(state.__r[6]);
+ GC_push_one(state.__r[7]);
+ GC_push_one(state.__r[8]);
+ GC_push_one(state.__r[9]);
+ GC_push_one(state.__r[10]);
+ GC_push_one(state.__r[11]);
+ GC_push_one(state.__r[12]);
+ /* GC_push_one(state.__sp); */
+ GC_push_one(state.__lr);
+ GC_push_one(state.__pc);
+ GC_push_one(state.__cpsr);
#else
# error FIXME for non-x86 || ppc architectures
#endif
GC_push_one(info.r30);
GC_push_one(info.r31);
#endif
-# else
+# elif defined(I386) /* !POWERPC */
/* FIXME: Remove after testing: */
WARN("This is completely untested and likely will not work\n", 0);
i386_thread_state_t info;
GC_push_one(info.fs);
GC_push_one(info.gs);
#endif
-# endif /* !POWERPC */
+# elif defined(ARM) /* !I386 */
+ arm_thread_state_t info;
+ mach_msg_type_number_t outCount = THREAD_STATE_MAX;
+ r = thread_get_state(thread, GC_MACH_THREAD_STATE_FLAVOR,
+ (natural_t *)&info, &outCount);
+ if(r != KERN_SUCCESS) continue;
+
+ lo = (void*)info.__sp;
+ hi = (ptr_t)FindTopOfStack(info.__sp);
+
+ GC_push_one(info.__r[0]);
+ GC_push_one(info.__r[1]);
+ GC_push_one(info.__r[2]);
+ GC_push_one(info.__r[3]);
+ GC_push_one(info.__r[4]);
+ GC_push_one(info.__r[5]);
+ GC_push_one(info.__r[6]);
+ GC_push_one(info.__r[7]);
+ GC_push_one(info.__r[8]);
+ GC_push_one(info.__r[9]);
+ GC_push_one(info.__r[10]);
+ GC_push_one(info.__r[11]);
+ GC_push_one(info.__r[12]);
+ /* GC_push_one(info.__sp); */
+ GC_push_one(info.__lr);
+ GC_push_one(info.__pc);
+ GC_push_one(info.__cpsr);
+# endif /* !ARM */
}
# if DEBUG_THREADS
GC_printf3("Darwin: Stack for thread 0x%lx = [%lx,%lx)\n",
# define FREEBSD
# endif
+/* And one for Darwin: */
+# if defined(macosx) || (defined(__APPLE__) && defined(__MACH__))
+# define DARWIN
+# endif
+
/* Determine the machine type: */
# if defined(__arm__) || defined(__thumb__)
# define ARM32
-# if !defined(LINUX) && !defined(NETBSD)
+# if !defined(LINUX) && !defined(NETBSD) && !defined(DARWIN)
# define NOSYS
# define mach_type_known
# endif
# define MACOS
# define mach_type_known
# endif
-# if defined(macosx) || (defined(__APPLE__) && defined(__MACH__))
-# define DARWIN
+# ifdef DARWIN
# if defined(__ppc__) || defined(__ppc64__)
# define POWERPC
# define mach_type_known
/* There seems to be some issues with trylock hanging on darwin. This
should be looked into some more */
# define NO_PTHREAD_TRYLOCK
+# elif defined(__arm__)
+# define ARM
+# define mach_type_known
+# define DARWIN_DONT_PARSE_STACK
# endif
# endif
# if defined(NeXT) && defined(mc68000)
# define OS_TYPE "MSWINCE"
# define DATAEND /* not needed */
# endif
+# ifdef DARWIN
+# define OS_TYPE "DARWIN"
+# define DATASTART ((ptr_t) get_etext())
+# define DATAEND ((ptr_t) get_end())
+# define STACKBOTTOM ((ptr_t) 0x30000000)
+# undef USE_MMAP
+# undef USE_MUNMAP
+# endif
# ifdef NOSYS
/* __data_start is usually defined in the target linker script. */
extern int __data_start[];