diff --git a/src/mono/mono/utils/CMakeLists.txt b/src/mono/mono/utils/CMakeLists.txt index e5dbf68b10f80a..858c072fccb30f 100644 --- a/src/mono/mono/utils/CMakeLists.txt +++ b/src/mono/mono/utils/CMakeLists.txt @@ -187,15 +187,9 @@ set(utils_arch_sources mach-support-unknown.c) elseif(HOST_AMD64) set(utils_arch_sources mach-support-amd64.c) -elseif(HOST_X86) -set(utils_arch_sources - mach-support-x86.c) elseif(HOST_ARM64) set(utils_arch_sources mach-support-arm64.c) -elseif(HOST_ARM) -set(utils_arch_sources - mach-support-arm.c) else() #message(FATAL_ERROR "") endif() diff --git a/src/mono/mono/utils/mach-support-arm.c b/src/mono/mono/utils/mach-support-arm.c deleted file mode 100644 index e08ab58452a841..00000000000000 --- a/src/mono/mono/utils/mach-support-arm.c +++ /dev/null @@ -1,104 +0,0 @@ -/** - * \file - * mach support for ARM - * - * Authors: - * Geoff Norton (gnorton@novell.com) - * Rodrigo Kumpera (kumpera@gmail.com) - * - * (C) 2010 Novell, Inc. - * (C) 2011 Xamarin, Inc. - */ - -#include - -#if defined(__MACH__) -#include -#include -#include -#include "utils/mono-sigcontext.h" -#include "utils/mono-compiler.h" -#include "mach-support.h" - -/* _mcontext.h now defines __darwin_mcontext32, not __darwin_mcontext, starting with Xcode 5.1 */ -#ifdef _STRUCT_MCONTEXT32 - #define __darwin_mcontext __darwin_mcontext32 -#endif - -int -mono_mach_arch_get_mcontext_size (void) -{ - return sizeof (struct __darwin_mcontext); -} - -void -mono_mach_arch_thread_states_to_mcontext (thread_state_t state, thread_state_t fpstate, void *context) -{ - arm_thread_state_t *arch_state = (arm_thread_state_t *) state; - struct __darwin_mcontext *ctx = (struct __darwin_mcontext *) context; - - ctx->__ss = *arch_state; -} - -void -mono_mach_arch_mcontext_to_thread_states (void *context, thread_state_t state, thread_state_t fpstate) -{ - arm_thread_state_t *arch_state = (arm_thread_state_t *) state; - struct __darwin_mcontext *ctx = (struct __darwin_mcontext *) context; - - *arch_state = ctx->__ss; -} - -void -mono_mach_arch_thread_states_to_mono_context (thread_state_t state, thread_state_t fpstate, MonoContext *context) -{ - int i; - arm_thread_state_t *arch_state = (arm_thread_state_t *) state; - for (i = 0; i < 13; ++i) - context->regs [i] = arch_state->__r [i]; - context->regs [ARMREG_R13] = arch_state->__sp; - context->regs [ARMREG_R14] = arch_state->__lr; - context->regs [ARMREG_R15] = arch_state->__pc; - context->pc = arch_state->__pc; - context->cpsr = arch_state->__cpsr; -} - -int -mono_mach_arch_get_thread_state_size (void) -{ - return sizeof (arm_thread_state_t); -} - -int -mono_mach_arch_get_thread_fpstate_size (void) -{ - return sizeof (arm_neon_state_t); -} - -kern_return_t -mono_mach_arch_get_thread_states (thread_port_t thread, thread_state_t state, mach_msg_type_number_t *count, thread_state_t fpstate, mach_msg_type_number_t *fpcount) -{ -#if defined(HOST_WATCHOS) - g_error ("thread_get_state() is not supported by this platform"); -#else - arm_thread_state_t *arch_state = (arm_thread_state_t *) state; - kern_return_t ret; - - *count = ARM_THREAD_STATE_COUNT; - - ret = thread_get_state (thread, ARM_THREAD_STATE, (thread_state_t) arch_state, count); - return ret; -#endif -} - -kern_return_t -mono_mach_arch_set_thread_states (thread_port_t thread, thread_state_t state, mach_msg_type_number_t count, thread_state_t fpstate, mach_msg_type_number_t fpcount) -{ -#if defined(HOST_WATCHOS) - g_error ("thread_set_state() is not supported by this platform"); -#else - return thread_set_state (thread, ARM_THREAD_STATE, state, count); -#endif -} - -#endif diff --git a/src/mono/mono/utils/mach-support-arm64.c b/src/mono/mono/utils/mach-support-arm64.c index 6ddd5a8911dabd..7e1258272c5cf4 100644 --- a/src/mono/mono/utils/mach-support-arm64.c +++ b/src/mono/mono/utils/mach-support-arm64.c @@ -20,11 +20,6 @@ #include "utils/mono-compiler.h" #include "mach-support.h" -/* _mcontext.h now defines __darwin_mcontext32, not __darwin_mcontext, starting with Xcode 5.1 */ -#ifdef _STRUCT_MCONTEXT32 - #define __darwin_mcontext __darwin_mcontext32 -#endif - int mono_mach_arch_get_mcontext_size (void) { diff --git a/src/mono/mono/utils/mach-support-x86.c b/src/mono/mono/utils/mach-support-x86.c deleted file mode 100644 index 389a8b6ae9245a..00000000000000 --- a/src/mono/mono/utils/mach-support-x86.c +++ /dev/null @@ -1,128 +0,0 @@ -/** - * \file - * mach support for x86 - * - * Authors: - * Geoff Norton (gnorton@novell.com) - * - * (C) 2010 Novell, Inc. - */ - -#include - -#if defined(__MACH__) -#include -#include -#include -#include "utils/mono-sigcontext.h" -#include "mach-support.h" - -// For reg numbers -#include - -int -mono_mach_arch_get_mcontext_size (void) -{ - return sizeof (struct __darwin_mcontext32); -} - -void -mono_mach_arch_thread_states_to_mcontext (thread_state_t state, thread_state_t fpstate, void *context) -{ - x86_thread_state32_t *arch_state = (x86_thread_state32_t *) state; - x86_float_state32_t *arch_fpstate = (x86_float_state32_t *) fpstate; - struct __darwin_mcontext32 *ctx = (struct __darwin_mcontext32 *) context; - ctx->__ss = *arch_state; - ctx->__fs = *arch_fpstate; -} - -void -mono_mach_arch_mcontext_to_thread_states (void *context, thread_state_t state, thread_state_t fpstate) -{ - x86_thread_state32_t *arch_state = (x86_thread_state32_t *) state; - x86_float_state32_t *arch_fpstate = (x86_float_state32_t *) fpstate; - struct __darwin_mcontext32 *ctx = (struct __darwin_mcontext32 *) context; - *arch_state = ctx->__ss; - *arch_fpstate = ctx->__fs; -} - -void -mono_mach_arch_thread_states_to_mono_context (thread_state_t state, thread_state_t fpstate, MonoContext *context) -{ - x86_thread_state32_t *arch_state = (x86_thread_state32_t *) state; - x86_float_state32_t *arch_fpstate = (x86_float_state32_t *) state; - context->eax = arch_state->__eax; - context->ebx = arch_state->__ebx; - context->ecx = arch_state->__ecx; - context->edx = arch_state->__edx; - context->ebp = arch_state->__ebp; - context->esp = arch_state->__esp; - context->esi = arch_state->__edi; - context->edi = arch_state->__esi; - context->eip = arch_state->__eip; - context->fregs [X86_XMM0] = arch_fpstate->__fpu_xmm0; - context->fregs [X86_XMM1] = arch_fpstate->__fpu_xmm1; - context->fregs [X86_XMM2] = arch_fpstate->__fpu_xmm2; - context->fregs [X86_XMM3] = arch_fpstate->__fpu_xmm3; - context->fregs [X86_XMM4] = arch_fpstate->__fpu_xmm4; - context->fregs [X86_XMM5] = arch_fpstate->__fpu_xmm5; - context->fregs [X86_XMM6] = arch_fpstate->__fpu_xmm6; - context->fregs [X86_XMM7] = arch_fpstate->__fpu_xmm7; -} - -int -mono_mach_arch_get_thread_state_size (void) -{ - return sizeof (x86_thread_state32_t); -} - -int -mono_mach_arch_get_thread_fpstate_size (void) -{ - return sizeof (x86_float_state32_t); -} - -kern_return_t -mono_mach_arch_get_thread_states (thread_port_t thread, thread_state_t state, mach_msg_type_number_t *count, thread_state_t fpstate, mach_msg_type_number_t *fpcount) -{ -#if defined(HOST_WATCHOS) - g_error ("thread_get_state() is not supported by this platform"); -#else - x86_thread_state32_t *arch_state = (x86_thread_state32_t *) state; - x86_float_state32_t *arch_fpstate = (x86_float_state32_t *) fpstate; - kern_return_t ret; - - *count = x86_THREAD_STATE32_COUNT; - *fpcount = x86_FLOAT_STATE32_COUNT; - - ret = thread_get_state (thread, x86_THREAD_STATE32, (thread_state_t)arch_state, count); - if (ret != KERN_SUCCESS) - return ret; - - ret = thread_get_state (thread, x86_FLOAT_STATE32, (thread_state_t)arch_fpstate, fpcount); - return ret; -#endif -} - -kern_return_t -mono_mach_arch_set_thread_states (thread_port_t thread, thread_state_t state, mach_msg_type_number_t count, thread_state_t fpstate, mach_msg_type_number_t fpcount) -{ -#if defined(HOST_WATCHOS) - g_error ("thread_set_state() is not supported by this platform"); -#else - kern_return_t ret; - ret = thread_set_state (thread, x86_THREAD_STATE32, state, count); - if (ret != KERN_SUCCESS) - return ret; - ret = thread_set_state (thread, x86_FLOAT_STATE32, fpstate, fpcount); - return ret; -#endif -} - -#else - -#include - -MONO_EMPTY_SOURCE_FILE (mach_support_x86); - -#endif diff --git a/src/mono/mono/utils/mach-support.h b/src/mono/mono/utils/mach-support.h index 0247db8bd1317e..9bc304604648ee 100644 --- a/src/mono/mono/utils/mach-support.h +++ b/src/mono/mono/utils/mach-support.h @@ -18,11 +18,6 @@ #include #define MONO_MACH_ARCH_SUPPORTED 1 -#if defined(__arm__) -typedef _STRUCT_MCONTEXT *mcontext_t; -#elif defined(__aarch64__) -typedef _STRUCT_MCONTEXT64 *mcontext_t; -#endif int mono_mach_arch_get_mcontext_size (void); void mono_mach_arch_thread_states_to_mcontext (thread_state_t state, thread_state_t fpstate, void *context);