aboutsummaryrefslogtreecommitdiff
path: root/boehm-gc
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2006-09-21 23:47:30 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2006-09-21 23:47:30 +0000
commit3869e51d3fa43d1032397c7abe34642ec5560f74 (patch)
treea59b18d3ecba84a151dd5bfc21322ecb5bb4fd21 /boehm-gc
parente81de9c8eb33a9dedf33078d08b9815b98acf55d (diff)
2006-09-21 Sandro Tolaini <tolaini@libero.it>
* os_dep.c: Port to Darwin/i386 * darwin_stop_world.c: Likewise * include/private/gcconfig.h: Likewise git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@117126 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'boehm-gc')
-rw-r--r--boehm-gc/ChangeLog6
-rw-r--r--boehm-gc/darwin_stop_world.c16
-rw-r--r--boehm-gc/include/private/gcconfig.h25
-rw-r--r--boehm-gc/os_dep.c10
4 files changed, 55 insertions, 2 deletions
diff --git a/boehm-gc/ChangeLog b/boehm-gc/ChangeLog
index 08b08e85ef7..84d47174ccf 100644
--- a/boehm-gc/ChangeLog
+++ b/boehm-gc/ChangeLog
@@ -1,3 +1,9 @@
+2006-09-21 Sandro Tolaini <tolaini@libero.it>
+
+ * os_dep.c: Port to Darwin/i386
+ * darwin_stop_world.c: Likewise
+ * include/private/gcconfig.h: Likewise
+
2006-06-07 Petr Salinger <Petr.Salinger@seznam.cz>
* configure.ac: add support for GNU/kFreeBSD, accepted by upstream
diff --git a/boehm-gc/darwin_stop_world.c b/boehm-gc/darwin_stop_world.c
index 895fdb61a64..a89f3f24ea0 100644
--- a/boehm-gc/darwin_stop_world.c
+++ b/boehm-gc/darwin_stop_world.c
@@ -125,7 +125,18 @@ void GC_push_all_stacks() {
(natural_t*)&state,
&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 . THREAD_FLD (r1) - PPC_RED_ZONE_SIZE);
GC_push_one(state . THREAD_FLD (r0));
@@ -159,6 +170,9 @@ void GC_push_all_stacks() {
GC_push_one(state . THREAD_FLD (r29));
GC_push_one(state . THREAD_FLD (r30));
GC_push_one(state . THREAD_FLD (r31));
+#else
+# error FIXME for non-x86 || ppc architectures
+#endif
} /* p != me */
if(p->flags & MAIN_THREAD)
hi = GC_stackbottom;
diff --git a/boehm-gc/include/private/gcconfig.h b/boehm-gc/include/private/gcconfig.h
index d7d96b11b60..26db82ee537 100644
--- a/boehm-gc/include/private/gcconfig.h
+++ b/boehm-gc/include/private/gcconfig.h
@@ -304,7 +304,7 @@
# define mach_type_known
# elif defined(__i386__)
# define I386
- --> Not really supported, but at least we recognize it.
+# define mach_type_known
# endif
# endif
# if defined(NeXT) && defined(mc68000)
@@ -1308,6 +1308,29 @@
/* # define MPROTECT_VDB Not quite working yet? */
# define DYNAMIC_LOADING
# 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) 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 -- disabled 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 /* DARWIN */
# endif
# ifdef NS32K
diff --git a/boehm-gc/os_dep.c b/boehm-gc/os_dep.c
index 13692d9bcd6..98ab6be5356 100644
--- a/boehm-gc/os_dep.c
+++ b/boehm-gc/os_dep.c
@@ -3802,6 +3802,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
@@ -3833,7 +3837,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