From: Geoff Norton Date: Fri, 23 Apr 2010 17:21:39 +0000 (+0000) Subject: 2010-04-23 Geoff Norton X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=984f7e130eda01ccd8dd821aecb637f68928c91f;p=gc 2010-04-23 Geoff Norton * include/private/gcconfig.h: Darwin x86-64 bit support. * darwin_stop_world.c: Ditto svn path=/trunk/mono/; revision=156016 --- diff --git a/ChangeLog b/ChangeLog index 1b0db023..114a3b27 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-04-23 Geoff Norton + + * include/private/gcconfig.h: Darwin x86-64 bit support. + * darwin_stop_world.c: Ditto + 2010-04-19 Jonathan Pryor * include/private/gcconfig.h: Android platforms are built atop Linux, diff --git a/darwin_stop_world.c b/darwin_stop_world.c index 0c85c005..7e60fe79 100644 --- a/darwin_stop_world.c +++ b/darwin_stop_world.c @@ -89,6 +89,9 @@ void GC_push_all_stacks() { #elif defined(ARM) arm_thread_state_t state; mach_msg_type_number_t thread_state_count = ARM_THREAD_STATE_COUNT; +#elif defined(X86_64) + x86_thread_state64_t state; + mach_msg_type_number_t thread_state_count = x86_THREAD_STATE64_COUNT; #else # error FIXME for non-x86 || ppc architectures mach_msg_type_number_t thread_state_count = MACHINE_THREAD_STATE_COUNT; @@ -109,7 +112,7 @@ void GC_push_all_stacks() { GC_MACH_THREAD_STATE_FLAVOR, (natural_t*)&state, &thread_state_count); - if(r != KERN_SUCCESS) ABORT("thread_get_state failed"); + if(r != KERN_SUCCESS) continue; #if defined(I386) #if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 @@ -134,6 +137,29 @@ void GC_push_all_stacks() { GC_push_one(state.esi); GC_push_one(state.ebp); #endif +#elif defined(X86_64) + lo = state.__rsp; + GC_push_one(state.__rax); + GC_push_one(state.__rbx); + GC_push_one(state.__rcx); + GC_push_one(state.__rdx); + GC_push_one(state.__rdi); + GC_push_one(state.__rsi); + GC_push_one(state.__rbp); + GC_push_one(state.__rsp); + GC_push_one(state.__r8); + GC_push_one(state.__r9); + GC_push_one(state.__r10); + GC_push_one(state.__r11); + GC_push_one(state.__r12); + GC_push_one(state.__r13); + GC_push_one(state.__r14); + GC_push_one(state.__r15); + GC_push_one(state.__rip); + GC_push_one(state.__rflags); + GC_push_one(state.__cs); + GC_push_one(state.__fs); + GC_push_one(state.__gs); #elif defined(POWERPC) #if defined(_STRUCT_PPC_EXCEPTION_STATE) lo = (void*)(state.__r1 - PPC_RED_ZONE_SIZE); diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h index 3d12de89..10ffed63 100644 --- a/include/private/gcconfig.h +++ b/include/private/gcconfig.h @@ -332,6 +332,9 @@ # define mach_type_known # define DARWIN_DONT_PARSE_STACK # define GC_DONT_REGISTER_MAIN_STATIC_DATA +# elif defined(__x86_64) +# define X86_64 +# define mach_type_known # endif # endif # if defined(NeXT) && defined(mc68000) @@ -2037,6 +2040,27 @@ # define PREFETCH_FOR_WRITE(x) __builtin_prefetch((x), 1) # endif # endif +# ifdef DARWIN +# define OS_TYPE "DARWIN" +# define DARWIN_DONT_PARSE_STACK +# define DYNAMIC_LOADING + /* XXX: see get_end(3), get_etext() and get_end() should not be used. + These aren't used when dyld support is enabled (it is by default) */ +# define DATASTART ((ptr_t) get_etext()) +# define DATAEND ((ptr_t) get_end()) +# define STACKBOTTOM ((ptr_t) 0x7fff5fc00000) +# ifndef USE_MMAP +# define USE_MMAP +# endif +# define USE_MMAP_ANON +# ifdef GC_DARWIN_THREADS +# define MPROTECT_VDB +# endif +# include +# define GETPAGESIZE() getpagesize() + /* There seems to be some issues with trylock hanging on darwin. This + should be looked into some more */ +# endif # ifdef FREEBSD # define OS_TYPE "FREEBSD" # ifndef GC_FREEBSD_THREADS