[MonoContext] Fix sgen STW cross compilation
authorLudovic Henry <ludovic@xamarin.com>
Tue, 10 May 2016 19:45:45 +0000 (15:45 -0400)
committerLudovic Henry <ludovic@xamarin.com>
Tue, 10 May 2016 19:45:45 +0000 (15:45 -0400)
mono/metadata/sgen-stw.c

index 593431841b48888d39c215368b1f948f001916e6..6af2a6f45c99e53e51f1967f775d56fb1a25961a 100644 (file)
@@ -51,12 +51,17 @@ update_current_thread_stack (void *start)
 {
        int stack_guard = 0;
        SgenThreadInfo *info = mono_thread_info_current ();
-       
+
        info->client_info.stack_start = align_pointer (&stack_guard);
        g_assert (info->client_info.stack_start);
        g_assert (info->client_info.stack_start >= info->client_info.stack_start_limit && info->client_info.stack_start < info->client_info.stack_end);
-       MONO_CONTEXT_GET_CURRENT (cur_thread_ctx);
-       memcpy (&info->client_info.ctx, &cur_thread_ctx, sizeof (MonoContext));
+
+#if !defined(MONO_CROSS_COMPILE) && MONO_ARCH_HAS_MONO_CONTEXT
+       MONO_CONTEXT_GET_CURRENT (info->client_info.ctx);
+#else
+       g_error ("Sgen STW requires a working mono-context");
+#endif
+
        if (mono_gc_get_gc_callbacks ()->thread_suspend_func)
                mono_gc_get_gc_callbacks ()->thread_suspend_func (info->client_info.runtime_data, NULL, &info->client_info.ctx);
 }