[Gc] [patch] sync darwin bits from gcc

Andreas Tobler toa at pop.agri.ch
Wed Jan 24 12:26:21 PST 2007


Hello,

this patch synchronizes some bits for darwin from the gcc tree.

It is mainly an update which will come up when OS-X 10.5 is out.

It also brings some updates for ppc64. This is WIP.

Ok?

Thanks,
Andreas

2007-01-24  Andreas Tobler  <a.tobler at schweiz.org>

	* darwin_stop_world.c: Move THREAD_FLD defines to ...
	* include/private/gc_priv.h: ... here.
	Fix THREAD_STATE definitions for ppc64.
	* os_dep.c (catch_exception_raise): Use THREAD_FLD for exc_state member
	access.
-------------- next part --------------
Index: darwin_stop_world.c
===================================================================
RCS file: /cvsroot/bdwgc/bdwgc/darwin_stop_world.c,v
retrieving revision 1.10
diff -u -r1.10 darwin_stop_world.c
--- darwin_stop_world.c	11 Jan 2007 19:32:44 -0000	1.10
+++ darwin_stop_world.c	24 Jan 2007 19:16:51 -0000
@@ -22,18 +22,7 @@
 # endif
 #endif
 
-/* Try to work out the right way to access thread state structure members.
-   The structure has changed its definition in different Darwin versions.  */
-/* 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
-#  define THREAD_FLD(x) x
-#endif
+
 
 typedef struct StackFrame {
   unsigned long	savedSP;
Index: os_dep.c
===================================================================
RCS file: /cvsroot/bdwgc/bdwgc/os_dep.c,v
retrieving revision 1.19
diff -u -r1.19 os_dep.c
--- os_dep.c	18 Jan 2007 18:51:49 -0000	1.19
+++ os_dep.c	24 Jan 2007 19:16:54 -0000
@@ -3895,9 +3895,9 @@
 
     /* This is the address that caused the fault */
 # if defined(POWERPC)
-    addr = (char*) exc_state.dar;
+    addr = (char*) exc_state. THREAD_FLD(dar);
 # elif defined (I386) || defined (X86_64)
-    addr = (char*) exc_state.faultvaddr;
+    addr = (char*) exc_state. THREAD_FLD(faultvaddr);
 # else
 #   error FIXME for non POWERPC/I386
 # endif
Index: include/private/gc_priv.h
===================================================================
RCS file: /cvsroot/bdwgc/bdwgc/include/private/gc_priv.h,v
retrieving revision 1.9
diff -u -r1.9 gc_priv.h
--- include/private/gc_priv.h	11 Jan 2007 19:32:44 -0000	1.9
+++ include/private/gc_priv.h	24 Jan 2007 19:16:56 -0000
@@ -367,15 +367,17 @@
 #	if defined(POWERPC)
 #		if CPP_WORDSZ == 32
 #                 define GC_THREAD_STATE_T ppc_thread_state_t
+#		  define GC_MACH_THREAD_STATE PPC_THREAD_STATE
+#		  define GC_MACH_THREAD_STATE_COUNT PPC_THREAD_STATE_COUNT
 #		  define GC_MACH_HEADER mach_header
 #		  define GC_MACH_SECTION section
 #	        else
 #                 define GC_THREAD_STATE_T ppc_thread_state64_t
+#		  define GC_MACH_THREAD_STATE PPC_THREAD_STATE64
+#		  define GC_MACH_THREAD_STATE_COUNT PPC_THREAD_STATE64_COUNT
 #		  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
@@ -395,6 +397,18 @@
 #		define GC_MACH_THREAD_STATE MACHINE_THREAD_STATE
 #		define GC_MACH_THREAD_STATE_COUNT MACHINE_THREAD_STATE_COUNT
 #	endif
+/* Try to work out the right way to access thread state structure members.
+   The structure has changed its definition in different Darwin versions.
+   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
+#         define THREAD_FLD(x) x
+#       endif
 #endif
 
 /*********************************/


More information about the Gc mailing list