Fix a typo for Rodrigo
[mono.git] / mono / utils / mach-support-amd64.c
index 2b544e7b3e6a9071a5174c76689deb2f1a374769..a2abd0bbf8fd70478133f75d79f876f4f4d0e114 100644 (file)
@@ -42,11 +42,20 @@ void
 mono_mach_arch_thread_state_to_mcontext (thread_state_t state, mcontext_t context)
 {
        x86_thread_state64_t *arch_state = (x86_thread_state64_t *) state;
-       struct __darwin_mcontext64 *ctx = (struct __darwin_mcontex64 *) context;
+       struct __darwin_mcontext64 *ctx = (struct __darwin_mcontext64 *) context;
 
        ctx->__ss = *arch_state;
 }
 
+void
+mono_mach_arch_mcontext_to_thread_state (mcontext_t context, thread_state_t state)
+{
+       x86_thread_state64_t *arch_state = (x86_thread_state64_t *) state;
+       struct __darwin_mcontext64 *ctx = (struct __darwin_mcontext64 *) context;
+
+       *arch_state = ctx->__ss;
+}
+
 int
 mono_mach_arch_get_thread_state_size ()
 {
@@ -66,6 +75,12 @@ mono_mach_arch_get_thread_state (thread_port_t thread, thread_state_t state, mac
        return ret;
 }
 
+kern_return_t
+mono_mach_arch_set_thread_state (thread_port_t thread, thread_state_t state, mach_msg_type_number_t count)
+{
+       return thread_set_state (thread, x86_THREAD_STATE64, state, count);
+}
+
 void *
 mono_mach_arch_get_tls_value_from_thread (pthread_t thread, guint32 key)
 {
@@ -74,7 +89,7 @@ mono_mach_arch_get_tls_value_from_thread (pthread_t thread, guint32 key)
         * is baked into their pthread_getspecific implementation
         */
        intptr_t *p = (intptr_t *)thread;
-       intptr_t **tsd = (intptr_t **) (p + 0x60);
+       intptr_t **tsd = (intptr_t **) ((char*)p + 0x60);
 
        return (void *) tsd [key];
 }