2009-11-05 Rodrigo Kumpera <rkumpera@novell.com>
[mono.git] / mono / metadata / sgen-gc.h
index 8372b6546cf9db83ff882bb69339b204b5ea5378..1f8037e3b9612cd3fa54bd3c39c3a78682005412 100644 (file)
@@ -1,45 +1,25 @@
 #ifndef __MONO_SGENGC_H__
 #define __MONO_SGENGC_H__
 
-#ifdef __i386__
-#define ARCH_NUM_REGS 8
-#define ARCH_STORE_REGS(ptr)   \
-       __asm__ __volatile__(   \
-               "mov %%ecx, 0x00(%0)\n" \
-               "mov %%edx, 0x04(%0)\n" \
-               "mov %%ebx, 0x08(%0)\n" \
-               "mov %%edi, 0x0c(%0)\n" \
-               "mov %%esi, 0x10(%0)\n" \
-               "mov %%ebp, 0x14(%0)\n" \
-               : "=&a" (ptr)   \
-               : "0" (cur_thread_regs) \
-               : "memory"      \
-       )
+/* pthread impl */
+#include <pthread.h>
 
-#elif defined(__x86_64__)
-#define ARCH_NUM_REGS 16
-#define ARCH_STORE_REGS(ptr)   \
-       __asm__ __volatile__(   \
-               "movq %%rcx, 0x00(%0)\n"        \
-               "movq %%rdx, 0x08(%0)\n"        \
-               "movq %%rbx, 0x10(%0)\n"        \
-               "movq %%rdi, 0x18(%0)\n"        \
-               "movq %%rsi, 0x20(%0)\n"        \
-               "movq %%rbp, 0x28(%0)\n"        \
-               "movq %%r8, 0x30(%0)\n" \
-               "movq %%r9, 0x38(%0)\n" \
-               "movq %%r10, 0x40(%0)\n"        \
-               "movq %%r11, 0x48(%0)\n"        \
-               "movq %%r12, 0x50(%0)\n"        \
-               "movq %%r13, 0x58(%0)\n"        \
-               "movq %%r14, 0x60(%0)\n"        \
-               "movq %%r15, 0x68(%0)\n"        \
-               : "=&a" (ptr)   \
-               : "0" (cur_thread_regs) \
-               : "memory"      \
-       )
+#define ARCH_THREAD_TYPE pthread_t
+#define ARCH_GET_THREAD pthread_self
+#define ARCH_THREAD_EQUALS(a,b) pthread_equal (a, b)
 
-#endif
+/*
+ * Recursion is not allowed for the thread lock.
+ */
+#define LOCK_DECLARE(name) pthread_mutex_t name = PTHREAD_MUTEX_INITIALIZER
+#define LOCK_INIT(name)
+#define LOCK_GC pthread_mutex_lock (&gc_mutex)
+#define UNLOCK_GC pthread_mutex_unlock (&gc_mutex)
+
+/* non-pthread will need to provide their own version of start/stop */
+#define USE_SIGNAL_BASED_START_STOP_WORLD 1
+/* we intercept pthread_create calls to know which threads exist */
+#define USE_PTHREAD_INTERCEPT 1
 
 #endif /* __MONO_SGENGC_H__ */