diff options
author | Paolo Molaro <lupus@oddwiz.org> | 2006-02-09 18:22:31 +0300 |
---|---|---|
committer | Paolo Molaro <lupus@oddwiz.org> | 2006-02-09 18:22:31 +0300 |
commit | ea6ba824965cb2b714030ca9072cc226cdfbe1c1 (patch) | |
tree | 15c15227d62654fe177a83a3b688ce0cc7fbf7f6 /libgc | |
parent | a60c6407fbeba77766e0daa1f1f62a6c12b96f05 (diff) |
Thu Feb 9 16:20:55 CET 2006 Paolo Molaro <lupus@ximian.com>
* os_dep.c, include/private/gcconfig.h, darwin_stop_world.c:
OSX/x86 support, mostly from Geoff Norton <gnorton@customerdna.com>.
svn path=/trunk/mono/; revision=56707
Diffstat (limited to 'libgc')
-rw-r--r-- | libgc/ChangeLog | 5 | ||||
-rw-r--r-- | libgc/darwin_stop_world.c | 20 | ||||
-rw-r--r-- | libgc/include/private/gcconfig.h | 23 | ||||
-rw-r--r-- | libgc/os_dep.c | 10 |
4 files changed, 57 insertions, 1 deletions
diff --git a/libgc/ChangeLog b/libgc/ChangeLog index f80efc37e12..b030f875835 100644 --- a/libgc/ChangeLog +++ b/libgc/ChangeLog @@ -1,4 +1,9 @@ +Thu Feb 9 16:20:55 CET 2006 Paolo Molaro <lupus@ximian.com> + + * os_dep.c, include/private/gcconfig.h, darwin_stop_world.c: + OSX/x86 support, mostly from Geoff Norton <gnorton@customerdna.com>. + Wed Feb 1 18:23:55 CET 2006 Paolo Molaro <lupus@ximian.com> * pthread_support.c, *: back out Zoltan's patch since it's diff --git a/libgc/darwin_stop_world.c b/libgc/darwin_stop_world.c index 692b18db4db..53604450328 100644 --- a/libgc/darwin_stop_world.c +++ b/libgc/darwin_stop_world.c @@ -73,7 +73,13 @@ void GC_push_all_stacks() { GC_thread p; pthread_t me; ptr_t lo, hi; +#if defined(POWERPC) ppc_thread_state_t state; +#elif defined(I386) + i386_thread_state_t state; +#else +# error FIXME for non-x86 || ppc architectures +#endif mach_msg_type_number_t thread_state_count = MACHINE_THREAD_STATE_COUNT; me = pthread_self(); @@ -93,6 +99,17 @@ void GC_push_all_stacks() { &thread_state_count); if(r != KERN_SUCCESS) ABORT("thread_get_state failed"); +#if defined(I386) + lo = state.esp; + + GC_push_one(state.eax); + GC_push_one(state.ebx); + GC_push_one(state.ecx); + GC_push_one(state.edx); + GC_push_one(state.edi); + GC_push_one(state.esi); + GC_push_one(state.ebp); +#elif defined(POWERPC) lo = (void*)(state.r1 - PPC_RED_ZONE_SIZE); GC_push_one(state.r0); @@ -126,6 +143,9 @@ void GC_push_all_stacks() { GC_push_one(state.r29); GC_push_one(state.r30); GC_push_one(state.r31); +#else +# error FIXME for non-x86 || ppc architectures +#endif } /* p != me */ if(p->flags & MAIN_THREAD) hi = GC_stackbottom; diff --git a/libgc/include/private/gcconfig.h b/libgc/include/private/gcconfig.h index 4aeb31d8c1b..0175a3b2c0a 100644 --- a/libgc/include/private/gcconfig.h +++ b/libgc/include/private/gcconfig.h @@ -304,7 +304,28 @@ # define mach_type_known # elif defined(__i386__) # define I386 - --> Not really supported, but at least we recognize it. +# define mach_type_known +# define DARWIN_DONT_PARSE_STACK +# define OS_TYPE "DARWIN" +# 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) 0xc0000000) +# define USE_MMAP +# define USE_MMAP_ANON +# define USE_ASM_PUSH_REGS + /* This is potentially buggy. It needs more testing. See the comments in + os_dep.c. It relies on threads to track writes. */ +# ifdef GC_DARWIN_THREADS +/* # define MPROTECT_VDB -- diabled for now. May work for some apps. */ +# endif +# include <unistd.h> +# define GETPAGESIZE() getpagesize() + /* There seems to be some issues with trylock hanging on darwin. This + should be looked into some more */ +# define NO_PTHREAD_TRYLOCK # endif # endif # if defined(NeXT) && defined(mc68000) diff --git a/libgc/os_dep.c b/libgc/os_dep.c index d7beb58dd9b..ef80a9d093e 100644 --- a/libgc/os_dep.c +++ b/libgc/os_dep.c @@ -3819,6 +3819,10 @@ catch_exception_raise( mach_msg_type_number_t exc_state_count = PPC_EXCEPTION_STATE64_COUNT; ppc_exception_state64_t exc_state; # endif +# elif defined(I386) + thread_state_flavor_t flavor = i386_EXCEPTION_STATE; + mach_msg_type_number_t exc_state_count = i386_EXCEPTION_STATE_COUNT; + i386_exception_state_t exc_state; # else # error FIXME for non-ppc darwin # endif @@ -3850,7 +3854,13 @@ catch_exception_raise( } /* This is the address that caused the fault */ +#if defined(POWERPC) addr = (char*) exc_state.dar; +#elif defined (I386) + addr = (char*) exc_state.faultvaddr; +#else +# error FIXME for non POWERPC/I386 +#endif if((HDR(addr)) == 0) { /* Ugh... just like the SIGBUS problem above, it seems we get a bogus |