aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Tobler <a.tobler@schweiz.org>2007-01-11 20:06:45 +0000
committerAndreas Tobler <andreast@gcc.gnu.org>2007-01-11 21:06:45 +0100
commit583cb3d38f9c3a1b93938dd851e48af24827626d (patch)
tree702d33aaf045d9f70bceb0e22f3ef4a3727a2ddf
parent6f9f76e336e9ce7a1c070351e4d21e6b84c0e82c (diff)
downloadgcc-583cb3d38f9c3a1b93938dd851e48af24827626d.zip
gcc-583cb3d38f9c3a1b93938dd851e48af24827626d.tar.gz
gcc-583cb3d38f9c3a1b93938dd851e48af24827626d.tar.bz2
configure.ac: Replaced HAS_I386_THREAD_STATE_* with HAS_X86_THREAD_STATE32_* and...
2007-01-11 Andreas Tobler <a.tobler@schweiz.org> * configure.ac: Replaced HAS_I386_THREAD_STATE_* with HAS_X86_THREAD_STATE32_* and HAS_X86_THREAD_STATE64_* respectively. * configure: Regenerated. * include/private/gcconfig.h (DARWIN): Added X86_64 define for Darwin. Added base definitions for the X86_64 Darwin port. * include/private/gc_priv.h: Added definitions for Darwin MACH thread operations. Moved existing THREAD_STATE info from darwin_stop_world.c. * darwin_stop_world.c: Removed THREAD_STATE info. Added HAS_X86_THREAD_STATE64___RAX. And replaced HAS_I386_THREAD_STATE___EAX with HAS_X86_THREAD_STATE32___EAX. (GC_push_all_stacks): Use GC_MACH_THREAD_STATE_COUNT. Add code for X86_64 Darwin. * dyn_load.c (GC_dyld_name_for_hdr): Use GC_MACH_HEADER. (GC_dyld_image_add): Use GC_MACH_HEADER and GC_MACH_SECTION. Distinguish between getsectbynamefromheader_64 and getsectbynamefromheader. (GC_dyld_image_remove): Likewise. * os_dep.c (GC_dirty_init): Use GC_MACH_THREAD_STATE. (catch_exception_raise): Introduce exception information for I386 and X86_64 Darwin. Add X86_64 for exc_state.faultvaddr. From-SVN: r120684
-rw-r--r--boehm-gc/ChangeLog23
-rwxr-xr-xboehm-gc/configure292
-rw-r--r--boehm-gc/configure.ac43
-rw-r--r--boehm-gc/darwin_stop_world.c94
-rw-r--r--boehm-gc/dyn_load.c24
-rw-r--r--boehm-gc/include/private/gc_priv.h33
-rw-r--r--boehm-gc/include/private/gcconfig.h45
-rw-r--r--boehm-gc/os_dep.c18
8 files changed, 452 insertions, 120 deletions
diff --git a/boehm-gc/ChangeLog b/boehm-gc/ChangeLog
index 2739c38..9fd2d4b 100644
--- a/boehm-gc/ChangeLog
+++ b/boehm-gc/ChangeLog
@@ -1,3 +1,26 @@
+2007-01-11 Andreas Tobler <a.tobler@schweiz.org>
+
+ * configure.ac: Replaced HAS_I386_THREAD_STATE_* with
+ HAS_X86_THREAD_STATE32_* and HAS_X86_THREAD_STATE64_* respectively.
+ * configure: Regenerated.
+ * include/private/gcconfig.h (DARWIN): Added X86_64 define for Darwin.
+ Added base definitions for the X86_64 Darwin port.
+ * include/private/gc_priv.h: Added definitions for Darwin MACH thread
+ operations. Moved existing THREAD_STATE info from darwin_stop_world.c.
+ * darwin_stop_world.c: Removed THREAD_STATE info. Added
+ HAS_X86_THREAD_STATE64___RAX. And replaced HAS_I386_THREAD_STATE___EAX
+ with HAS_X86_THREAD_STATE32___EAX.
+ (GC_push_all_stacks): Use GC_MACH_THREAD_STATE_COUNT. Add code for
+ X86_64 Darwin.
+ * dyn_load.c (GC_dyld_name_for_hdr): Use GC_MACH_HEADER.
+ (GC_dyld_image_add): Use GC_MACH_HEADER and GC_MACH_SECTION.
+ Distinguish between getsectbynamefromheader_64 and
+ getsectbynamefromheader.
+ (GC_dyld_image_remove): Likewise.
+ * os_dep.c (GC_dirty_init): Use GC_MACH_THREAD_STATE.
+ (catch_exception_raise): Introduce exception information for I386 and
+ X86_64 Darwin. Add X86_64 for exc_state.faultvaddr.
+
2006-12-08 Mike Stump <mrs@apple.com>
* configure.ac: Fix x86 darwin builds.
diff --git a/boehm-gc/configure b/boehm-gc/configure
index f509b34..bf08621 100755
--- a/boehm-gc/configure
+++ b/boehm-gc/configure
@@ -5734,7 +5734,7 @@ echo "${ECHO_T}$ac_cv_member_ppc_thread_state_t_r0" >&6
if test $ac_cv_member_ppc_thread_state_t_r0 = yes; then
cat >>confdefs.h <<\_ACEOF
-#define HAS_PPC_THREAD_STATE_R0
+#define HAS_PPC_THREAD_STATE_R0 1
_ACEOF
fi
@@ -5845,7 +5845,7 @@ echo "${ECHO_T}$ac_cv_member_ppc_thread_state_t___r0" >&6
if test $ac_cv_member_ppc_thread_state_t___r0 = yes; then
cat >>confdefs.h <<\_ACEOF
-#define HAS_PPC_THREAD_STATE___R0
+#define HAS_PPC_THREAD_STATE___R0 1
_ACEOF
fi
@@ -5956,7 +5956,7 @@ echo "${ECHO_T}$ac_cv_member_ppc_thread_state64_t_r0" >&6
if test $ac_cv_member_ppc_thread_state64_t_r0 = yes; then
cat >>confdefs.h <<\_ACEOF
-#define HAS_PPC_THREAD_STATE64_R0
+#define HAS_PPC_THREAD_STATE64_R0 1
_ACEOF
fi
@@ -6067,16 +6067,16 @@ echo "${ECHO_T}$ac_cv_member_ppc_thread_state64_t___r0" >&6
if test $ac_cv_member_ppc_thread_state64_t___r0 = yes; then
cat >>confdefs.h <<\_ACEOF
-#define HAS_PPC_THREAD_STATE64___R0
+#define HAS_PPC_THREAD_STATE64___R0 1
_ACEOF
fi
;;
i?86*-*-darwin*)
- echo "$as_me:$LINENO: checking for i386_thread_state_t.eax" >&5
-echo $ECHO_N "checking for i386_thread_state_t.eax... $ECHO_C" >&6
-if test "${ac_cv_member_i386_thread_state_t_eax+set}" = set; then
+ echo "$as_me:$LINENO: checking for x86_thread_state32_t.eax" >&5
+echo $ECHO_N "checking for x86_thread_state32_t.eax... $ECHO_C" >&6
+if test "${ac_cv_member_x86_thread_state32_t_eax+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
@@ -6086,12 +6086,12 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <sys/cdefs.h>
-#include <mach/thread_status.h>
+ #include <mach/thread_status.h>
int
main ()
{
-static i386_thread_state_t ac_aggr;
+static x86_thread_state32_t ac_aggr;
if (ac_aggr.eax)
return 0;
;
@@ -6120,7 +6120,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_cv_member_i386_thread_state_t_eax=yes
+ ac_cv_member_x86_thread_state32_t_eax=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
@@ -6132,12 +6132,12 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <sys/cdefs.h>
-#include <mach/thread_status.h>
+ #include <mach/thread_status.h>
int
main ()
{
-static i386_thread_state_t ac_aggr;
+static x86_thread_state32_t ac_aggr;
if (sizeof ac_aggr.eax)
return 0;
;
@@ -6166,30 +6166,30 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_cv_member_i386_thread_state_t_eax=yes
+ ac_cv_member_x86_thread_state32_t_eax=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_member_i386_thread_state_t_eax=no
+ac_cv_member_x86_thread_state32_t_eax=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $ac_cv_member_i386_thread_state_t_eax" >&5
-echo "${ECHO_T}$ac_cv_member_i386_thread_state_t_eax" >&6
-if test $ac_cv_member_i386_thread_state_t_eax = yes; then
+echo "$as_me:$LINENO: result: $ac_cv_member_x86_thread_state32_t_eax" >&5
+echo "${ECHO_T}$ac_cv_member_x86_thread_state32_t_eax" >&6
+if test $ac_cv_member_x86_thread_state32_t_eax = yes; then
cat >>confdefs.h <<\_ACEOF
-#define HAS_I386_THREAD_STATE_EAX
+#define HAS_X86_THREAD_STATE32_EAX 1
_ACEOF
fi
- echo "$as_me:$LINENO: checking for i386_thread_state_t.__eax" >&5
-echo $ECHO_N "checking for i386_thread_state_t.__eax... $ECHO_C" >&6
-if test "${ac_cv_member_i386_thread_state_t___eax+set}" = set; then
+ echo "$as_me:$LINENO: checking for x86_thread_state32_t.__eax" >&5
+echo $ECHO_N "checking for x86_thread_state32_t.__eax... $ECHO_C" >&6
+if test "${ac_cv_member_x86_thread_state32_t___eax+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
@@ -6199,12 +6199,12 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <sys/cdefs.h>
-#include <mach/thread_status.h>
+ #include <mach/thread_status.h>
int
main ()
{
-static i386_thread_state_t ac_aggr;
+static x86_thread_state32_t ac_aggr;
if (ac_aggr.__eax)
return 0;
;
@@ -6233,7 +6233,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_cv_member_i386_thread_state_t___eax=yes
+ ac_cv_member_x86_thread_state32_t___eax=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
@@ -6245,12 +6245,12 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <sys/cdefs.h>
-#include <mach/thread_status.h>
+ #include <mach/thread_status.h>
int
main ()
{
-static i386_thread_state_t ac_aggr;
+static x86_thread_state32_t ac_aggr;
if (sizeof ac_aggr.__eax)
return 0;
;
@@ -6279,28 +6279,256 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_cv_member_i386_thread_state_t___eax=yes
+ ac_cv_member_x86_thread_state32_t___eax=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_member_i386_thread_state_t___eax=no
+ac_cv_member_x86_thread_state32_t___eax=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $ac_cv_member_i386_thread_state_t___eax" >&5
-echo "${ECHO_T}$ac_cv_member_i386_thread_state_t___eax" >&6
-if test $ac_cv_member_i386_thread_state_t___eax = yes; then
+echo "$as_me:$LINENO: result: $ac_cv_member_x86_thread_state32_t___eax" >&5
+echo "${ECHO_T}$ac_cv_member_x86_thread_state32_t___eax" >&6
+if test $ac_cv_member_x86_thread_state32_t___eax = yes; then
cat >>confdefs.h <<\_ACEOF
-#define HAS_I386_THREAD_STATE___EAX
+#define HAS_X86_THREAD_STATE32___EAX 1
_ACEOF
fi
;;
+ x86_64-*-darwin*)
+ echo "$as_me:$LINENO: checking for x86_thread_state64_t.rax" >&5
+echo $ECHO_N "checking for x86_thread_state64_t.rax... $ECHO_C" >&6
+if test "${ac_cv_member_x86_thread_state64_t_rax+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/cdefs.h>
+ #include <mach/thread_status.h>
+
+int
+main ()
+{
+static x86_thread_state64_t ac_aggr;
+if (ac_aggr.rax)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_member_x86_thread_state64_t_rax=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/cdefs.h>
+ #include <mach/thread_status.h>
+
+int
+main ()
+{
+static x86_thread_state64_t ac_aggr;
+if (sizeof ac_aggr.rax)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_member_x86_thread_state64_t_rax=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_member_x86_thread_state64_t_rax=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_member_x86_thread_state64_t_rax" >&5
+echo "${ECHO_T}$ac_cv_member_x86_thread_state64_t_rax" >&6
+if test $ac_cv_member_x86_thread_state64_t_rax = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAS_X86_THREAD_STATE64_RAX 1
+_ACEOF
+
+fi
+
+ echo "$as_me:$LINENO: checking for x86_thread_state64_t.__rax" >&5
+echo $ECHO_N "checking for x86_thread_state64_t.__rax... $ECHO_C" >&6
+if test "${ac_cv_member_x86_thread_state64_t___rax+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/cdefs.h>
+ #include <mach/thread_status.h>
+
+int
+main ()
+{
+static x86_thread_state64_t ac_aggr;
+if (ac_aggr.__rax)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_member_x86_thread_state64_t___rax=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/cdefs.h>
+ #include <mach/thread_status.h>
+
+int
+main ()
+{
+static x86_thread_state64_t ac_aggr;
+if (sizeof ac_aggr.__rax)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_member_x86_thread_state64_t___rax=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_member_x86_thread_state64_t___rax=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_member_x86_thread_state64_t___rax" >&5
+echo "${ECHO_T}$ac_cv_member_x86_thread_state64_t___rax" >&6
+if test $ac_cv_member_x86_thread_state64_t___rax = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAS_X86_THREAD_STATE64___RAX 1
+_ACEOF
+
+fi
+
+ ;;
*) ;;
esac
diff --git a/boehm-gc/configure.ac b/boehm-gc/configure.ac
index 84dd7ec..2beaa1c 100644
--- a/boehm-gc/configure.ac
+++ b/boehm-gc/configure.ac
@@ -248,33 +248,46 @@ AM_CONDITIONAL(POWERPC_DARWIN,test x$powerpc_darwin = xtrue)
case "$host" in
powerpc*-*-darwin*)
AC_CHECK_MEMBER(ppc_thread_state_t.r0,
- AC_DEFINE(HAS_PPC_THREAD_STATE_R0,,[ppc_thread_state_t has field r0]),,
+ AC_DEFINE(HAS_PPC_THREAD_STATE_R0,1,
+ [ppc_thread_state_t has field r0]),,
[#include <mach/thread_status.h>])
AC_CHECK_MEMBER(ppc_thread_state_t.__r0,
- AC_DEFINE(HAS_PPC_THREAD_STATE___R0,,dnl
- [ppc_thread_state_t has field __r0]),,
+ AC_DEFINE(HAS_PPC_THREAD_STATE___R0,1,dnl
+ [ppc_thread_state_t has field __r0]),,
[#include <mach/thread_status.h>])
AC_CHECK_MEMBER(ppc_thread_state64_t.r0,
- AC_DEFINE(HAS_PPC_THREAD_STATE64_R0,,dnl
- [ppc_thread_state64_t has field r0]),,
+ AC_DEFINE(HAS_PPC_THREAD_STATE64_R0,1,dnl
+ [ppc_thread_state64_t has field r0]),,
[#include <mach/thread_status.h>])
AC_CHECK_MEMBER(ppc_thread_state64_t.__r0,
- AC_DEFINE(HAS_PPC_THREAD_STATE64___R0,,dnl
- [ppc_thread_state64_t has field __r0]),,
+ AC_DEFINE(HAS_PPC_THREAD_STATE64___R0,1,dnl
+ [ppc_thread_state64_t has field __r0]),,
[#include <mach/thread_status.h>])
;;
i?86*-*-darwin*)
- AC_CHECK_MEMBER(i386_thread_state_t.eax,
- AC_DEFINE(HAS_I386_THREAD_STATE_EAX,,dnl
- [i386_thread_state_t has field eax]),,
+ AC_CHECK_MEMBER(x86_thread_state32_t.eax,
+ AC_DEFINE(HAS_X86_THREAD_STATE32_EAX,1,dnl
+ [x86_thread_state32_t has field eax]),,
[#include <sys/cdefs.h>
-#include <mach/thread_status.h>])
- AC_CHECK_MEMBER(i386_thread_state_t.__eax,
- AC_DEFINE(HAS_I386_THREAD_STATE___EAX,,dnl
- [i386_thread_state_t has field __eax]),,
+ #include <mach/thread_status.h>])
+ AC_CHECK_MEMBER(x86_thread_state32_t.__eax,
+ AC_DEFINE(HAS_X86_THREAD_STATE32___EAX,1,dnl
+ [x86_thread_state32_t has field __eax]),,
[#include <sys/cdefs.h>
-#include <mach/thread_status.h>])
+ #include <mach/thread_status.h>])
;;
+ x86_64-*-darwin*)
+ AC_CHECK_MEMBER(x86_thread_state64_t.rax,
+ AC_DEFINE(HAS_X86_THREAD_STATE64_RAX,1,dnl
+ [x86_thread_state64_t has field rax]),,
+ [#include <sys/cdefs.h>
+ #include <mach/thread_status.h>])
+ AC_CHECK_MEMBER(x86_thread_state64_t.__rax,
+ AC_DEFINE(HAS_X86_THREAD_STATE64___RAX,1,dnl
+ [x86_thread_state64_t has field __rax]),,
+ [#include <sys/cdefs.h>
+ #include <mach/thread_status.h>])
+ ;;
*) ;;
esac
diff --git a/boehm-gc/darwin_stop_world.c b/boehm-gc/darwin_stop_world.c
index bdd6f3a..5ddb271 100644
--- a/boehm-gc/darwin_stop_world.c
+++ b/boehm-gc/darwin_stop_world.c
@@ -10,7 +10,7 @@
be allocated, is called the red zone. This area as shown in Figure 3-2 may
be used for any purpose as long as a new stack frame does not need to be
added to the stack."
-
+
Page 50: "If a leaf procedure's red zone usage would exceed 224 bytes, then
it must set up a stack frame just like routines that call other routines."
*/
@@ -22,44 +22,15 @@
/* Try to work out the right way to access thread state structure members.
The structure has changed its definition in different Darwin versions. */
-#if defined(__ppc__)
-# define THREAD_STATE ppc_thread_state_t
-# if defined (HAS_PPC_THREAD_STATE_R0)
-# define THREAD_FLD(x) x
-# elif defined (HAS_PPC_THREAD_STATE___R0)
+/* This now defaults to the (older) names without __, thus hopefully */
+/* not breaking any existing Makefile.direct builds. */
+#if defined (HAS_PPC_THREAD_STATE___R0) || \
+ defined (HAS_PPC_THREAD_STATE64___R0) || \
+ defined (HAS_X86_THREAD_STATE32___EAX) || \
+ defined (HAS_X86_THREAD_STATE64___RAX)
# define THREAD_FLD(x) __ ## x
-# else
-# error can not work out how to access fields of ppc_thread_state_t
-# endif
-#elif defined(__ppc64__)
-# define THREAD_STATE ppc_thread_state64_t
-# if defined (HAS_PPC_THREAD_STATE64_R0)
-# define THREAD_FLD(x) x
-# elif defined (HAS_PPC_THREAD_STATE64___R0)
-# define THREAD_FLD(x) __ ## x
-# else
-# error can not work out how to access fields of ppc_thread_state64_t
-# endif
-#elif defined(__i386__)
-# define THREAD_STATE i386_thread_state_t
-# if defined (HAS_I386_THREAD_STATE_EAX)
-# define THREAD_FLD(x) x
-# elif defined (HAS_I386_THREAD_STATE___EAX)
-# define THREAD_FLD(x) __ ## x
-# else
-# error can not work out how to access fields of i386_thread_state_t
-# endif
-#elif defined(__x86_64__)
-# define THREAD_STATE i386_thread_state_t
-# if defined (HAS_I386_THREAD_STATE_EAX)
-# define THREAD_FLD(x) x
-# elif defined (HAS_I386_THREAD_STATE___EAX)
-# define THREAD_FLD(x) __ ## x
-# else
-# error can not work out how to access fields of i386_thread_state_t
-# endif
#else
-# error unknown architecture
+# define THREAD_FLD(x) x
#endif
typedef struct StackFrame {
@@ -115,8 +86,8 @@ void GC_push_all_stacks() {
GC_thread p;
pthread_t me;
ptr_t lo, hi;
- THREAD_STATE state;
- mach_msg_type_number_t thread_state_count = MACHINE_THREAD_STATE_COUNT;
+ GC_THREAD_STATE_T state;
+ mach_msg_type_number_t thread_state_count = GC_MACH_THREAD_STATE_COUNT;
me = pthread_self();
if (!GC_thr_initialized) GC_thr_init();
@@ -128,11 +99,8 @@ void GC_push_all_stacks() {
lo = GC_approx_sp();
} else {
/* Get the thread state (registers, etc) */
- r = thread_get_state(
- p->stop_info.mach_thread,
- MACHINE_THREAD_STATE,
- (natural_t*)&state,
- &thread_state_count);
+ r = thread_get_state(p->stop_info.mach_thread, GC_MACH_THREAD_STATE,
+ (natural_t*)&state, &thread_state_count);
if(r != KERN_SUCCESS) ABORT("thread_get_state failed");
#if defined(I386)
@@ -144,7 +112,33 @@ void GC_push_all_stacks() {
GC_push_one(state . THREAD_FLD (edx));
GC_push_one(state . THREAD_FLD (edi));
GC_push_one(state . THREAD_FLD (esi));
- GC_push_one(state . THREAD_FLD (ebp));
+ GC_push_one(state . THREAD_FLD (ebp));
+
+#elif defined(X86_64)
+ lo = (void*)state . THREAD_FLD (rsp);
+
+ GC_push_one(state . THREAD_FLD (rax));
+ GC_push_one(state . THREAD_FLD (rbx));
+ GC_push_one(state . THREAD_FLD (rcx));
+ GC_push_one(state . THREAD_FLD (rdx));
+ GC_push_one(state . THREAD_FLD (rdi));
+ GC_push_one(state . THREAD_FLD (rsi));
+ GC_push_one(state . THREAD_FLD (rbp));
+ GC_push_one(state . THREAD_FLD (rsp));
+ GC_push_one(state . THREAD_FLD (r8));
+ GC_push_one(state . THREAD_FLD (r9));
+ GC_push_one(state . THREAD_FLD (r10));
+ GC_push_one(state . THREAD_FLD (r11));
+ GC_push_one(state . THREAD_FLD (r12));
+ GC_push_one(state . THREAD_FLD (r13));
+ GC_push_one(state . THREAD_FLD (r14));
+ GC_push_one(state . THREAD_FLD (r15));
+ GC_push_one(state . THREAD_FLD (rip));
+ GC_push_one(state . THREAD_FLD (rflags));
+ GC_push_one(state . THREAD_FLD (cs));
+ GC_push_one(state . THREAD_FLD (fs));
+ GC_push_one(state . THREAD_FLD (gs));
+
#elif defined(POWERPC)
lo = (void*)(state . THREAD_FLD (r1) - PPC_RED_ZONE_SIZE);
@@ -221,9 +215,9 @@ void GC_push_all_stacks() {
hi = (ptr_t)FindTopOfStack(0);
} else {
# if defined(__ppc__) || defined(__ppc64__)
- THREAD_STATE info;
+ GC_THREAD_STATE_T info;
mach_msg_type_number_t outCount = THREAD_STATE_MAX;
- r = thread_get_state(thread, MACHINE_THREAD_STATE,
+ r = thread_get_state(thread, GC_MACH_THREAD_STATE,
(natural_t *)&info, &outCount);
if(r != KERN_SUCCESS) ABORT("task_get_state failed");
@@ -264,10 +258,10 @@ void GC_push_all_stacks() {
# else
/* FIXME: Remove after testing: */
WARN("This is completely untested and likely will not work\n", 0);
- THREAD_STATE info;
+ GC_THREAD_STATE_T info;
mach_msg_type_number_t outCount = THREAD_STATE_MAX;
- r = thread_get_state(thread, MACHINE_THREAD_STATE,
- (natural_t *)&info, &outCount);
+ r = thread_get_state(thread, GC_MACH_THREAD_STATE, (natural_t *)&info,
+ &outCount);
if(r != KERN_SUCCESS) ABORT("task_get_state failed");
lo = (void*)info . THREAD_FLD (esp);
diff --git a/boehm-gc/dyn_load.c b/boehm-gc/dyn_load.c
index d82bad8..1128cee 100644
--- a/boehm-gc/dyn_load.c
+++ b/boehm-gc/dyn_load.c
@@ -1152,7 +1152,7 @@ const static struct {
};
#ifdef DARWIN_DEBUG
-static const char *GC_dyld_name_for_hdr(struct mach_header *hdr) {
+static const char *GC_dyld_name_for_hdr(const struct GC_MACH_HEADER *hdr) {
unsigned long i,c;
c = _dyld_image_count();
for(i=0;i<c;i++) if(_dyld_get_image_header(i) == hdr)
@@ -1162,12 +1162,17 @@ static const char *GC_dyld_name_for_hdr(struct mach_header *hdr) {
#endif
/* This should never be called by a thread holding the lock */
-static void GC_dyld_image_add(struct mach_header* hdr, unsigned long slide) {
+static void GC_dyld_image_add(const struct GC_MACH_HEADER *hdr, intptr_t slide)
+{
unsigned long start,end,i;
- const struct section *sec;
+ const struct GC_MACH_SECTION *sec;
if (GC_no_dls) return;
for(i=0;i<sizeof(GC_dyld_sections)/sizeof(GC_dyld_sections[0]);i++) {
- sec = getsectbynamefromheader(
+# if defined (__LP64__)
+ sec = getsectbynamefromheader_64(
+# else
+ sec = getsectbynamefromheader(
+# endif
hdr,GC_dyld_sections[i].seg,GC_dyld_sections[i].sect);
if(sec == NULL || sec->size == 0) continue;
start = slide + sec->addr;
@@ -1184,11 +1189,16 @@ static void GC_dyld_image_add(struct mach_header* hdr, unsigned long slide) {
}
/* This should never be called by a thread holding the lock */
-static void GC_dyld_image_remove(struct mach_header* hdr, unsigned long slide) {
+static void GC_dyld_image_remove(const struct GC_MACH_HEADER *hdr,
+ intptr_t slide) {
unsigned long start,end,i;
- const struct section *sec;
+ const struct GC_MACH_SECTION *sec;
for(i=0;i<sizeof(GC_dyld_sections)/sizeof(GC_dyld_sections[0]);i++) {
- sec = getsectbynamefromheader(
+# if defined (__LP64__)
+ sec = getsectbynamefromheader_64(
+# else
+ sec = getsectbynamefromheader(
+# endif
hdr,GC_dyld_sections[i].seg,GC_dyld_sections[i].sect);
if(sec == NULL || sec->size == 0) continue;
start = slide + sec->addr;
diff --git a/boehm-gc/include/private/gc_priv.h b/boehm-gc/include/private/gc_priv.h
index 38685bc..f72faf9 100644
--- a/boehm-gc/include/private/gc_priv.h
+++ b/boehm-gc/include/private/gc_priv.h
@@ -468,6 +468,39 @@ extern GC_warn_proc GC_current_warn_proc;
# define GETENV(name) 0
#endif
+#if defined(DARWIN)
+# if defined(POWERPC)
+# if CPP_WORDSZ == 32
+# define GC_THREAD_STATE_T ppc_thread_state_t
+# define GC_MACH_HEADER mach_header
+# define GC_MACH_SECTION section
+# else
+# define GC_THREAD_STATE_T ppc_thread_state64_t
+# define GC_MACH_HEADER mach_header_64
+# define GC_MACH_SECTION section_64
+# endif
+# define GC_MACH_THREAD_STATE PPC_THREAD_STATE
+# define GC_MACH_THREAD_STATE_COUNT PPC_THREAD_STATE_COUNT
+# elif defined(I386) || defined(X86_64)
+# if CPP_WORDSZ == 32
+# define GC_THREAD_STATE_T x86_thread_state32_t
+# define GC_MACH_THREAD_STATE x86_THREAD_STATE32
+# define GC_MACH_THREAD_STATE_COUNT x86_THREAD_STATE32_COUNT
+# define GC_MACH_HEADER mach_header
+# define GC_MACH_SECTION section
+# else
+# define GC_THREAD_STATE_T x86_thread_state64_t
+# define GC_MACH_THREAD_STATE x86_THREAD_STATE64
+# define GC_MACH_THREAD_STATE_COUNT x86_THREAD_STATE64_COUNT
+# define GC_MACH_HEADER mach_header_64
+# define GC_MACH_SECTION section_64
+# endif
+# else
+# error define GC_THREAD_STATE_T
+# define GC_MACH_THREAD_STATE MACHINE_THREAD_STATE
+# define GC_MACH_THREAD_STATE_COUNT MACHINE_THREAD_STATE_COUNT
+# endif
+#endif
/*********************************/
/* */
/* Word-size-dependent defines */
diff --git a/boehm-gc/include/private/gcconfig.h b/boehm-gc/include/private/gcconfig.h
index e06a756..ef22232 100644
--- a/boehm-gc/include/private/gcconfig.h
+++ b/boehm-gc/include/private/gcconfig.h
@@ -302,7 +302,10 @@
# if defined(__ppc__) || defined(__ppc64__)
# define POWERPC
# define mach_type_known
-# elif defined(__i386__) || defined(__x86_64)
+# elif defined(__x86_64__)
+# define X86_64
+# define mach_type_known
+# elif defined(__i386__)
# define I386
# define mach_type_known
# endif
@@ -787,7 +790,7 @@
# define DATAEND (_end)
# endif
# ifdef DARWIN
-# if defined(__ppc64__) || defined(__x86_64)
+# if defined(__ppc64__)
# define ALIGNMENT 8
# define CPP_WORDSZ 64
# else
@@ -796,7 +799,7 @@
# 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) */
+ 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)
@@ -804,9 +807,9 @@
# 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. */
+ 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. */
+/*# define MPROTECT_VDB -- diabled for now. May work for some apps. */
# endif
# include <unistd.h>
# define GETPAGESIZE() getpagesize()
@@ -818,7 +821,7 @@
__asm__ __volatile__ ("dcbtst 0,%0" : : "r" ((const void *) (x)))
# endif
/* There seems to be some issues with trylock hanging on darwin. This
- should be looked into some more */
+ should be looked into some more */
# define NO_PTHREAD_TRYLOCK
# endif
# ifdef FREEBSD
@@ -1313,7 +1316,7 @@
# 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) */
+ 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)
@@ -1321,15 +1324,15 @@
# 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. */
+ 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
+ should be looked into some more */
+# define NO_PTHREAD_TRYLOCK
# endif /* DARWIN */
# endif
@@ -1982,6 +1985,28 @@
# 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)
+# define USE_MMAP
+# define USE_MMAP_ANON
+# ifdef GC_DARWIN_THREADS
+ /* This is potentially buggy. It needs more testing. See the comments in
+ os_dep.c. It relies on threads to track writes. */
+# define MPROTECT_VDB
+# 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
# ifdef FREEBSD
# define OS_TYPE "FREEBSD"
# ifndef GC_FREEBSD_THREADS
diff --git a/boehm-gc/os_dep.c b/boehm-gc/os_dep.c
index 98ab6be..5a0e59f 100644
--- a/boehm-gc/os_dep.c
+++ b/boehm-gc/os_dep.c
@@ -3683,7 +3683,7 @@ void GC_dirty_init() {
mask,
GC_ports.exception,
EXCEPTION_DEFAULT,
- MACHINE_THREAD_STATE
+ GC_MACH_THREAD_STATE
);
if(r != KERN_SUCCESS) ABORT("task_set_exception_ports failed");
@@ -3802,10 +3802,16 @@ 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;
+# elif defined(I386) || defined(X86_64)
+# if CPP_WORDSZ == 32
+ thread_state_flavor_t flavor = x86_EXCEPTION_STATE32;
+ mach_msg_type_number_t exc_state_count = x86_EXCEPTION_STATE32_COUNT;
+ x86_exception_state_t exc_state;
+# else
+ thread_state_flavor_t flavor = x86_EXCEPTION_STATE64;
+ mach_msg_type_number_t exc_state_count = x86_EXCEPTION_STATE64_COUNT;
+ x86_exception_state64_t exc_state;
+# endif
# else
# error FIXME for non-ppc darwin
# endif
@@ -3839,7 +3845,7 @@ catch_exception_raise(
/* This is the address that caused the fault */
#if defined(POWERPC)
addr = (char*) exc_state.dar;
-#elif defined (I386)
+#elif defined (I386) || defined (X86_64)
addr = (char*) exc_state.faultvaddr;
#else
# error FIXME for non POWERPC/I386