gcconfig.h: Add unified test for FreeBSD.
authorLoren J. Rittle <ljrittle@acm.org>
Fri, 22 Mar 2002 02:40:32 +0000 (02:40 +0000)
committerLoren J. Rittle <ljrittle@gcc.gnu.org>
Fri, 22 Mar 2002 02:40:32 +0000 (02:40 +0000)
* include/private/gcconfig.h: Add unified test for FreeBSD.
Support FreeBSD/alpha.
* os_dep.c: Do not include <machine/trap.h> unless available.
(GC_freebsd_stack_base): Fix types.

From-SVN: r51159

boehm-gc/ChangeLog
boehm-gc/include/private/gcconfig.h
boehm-gc/os_dep.c

index c0b897c..5f1c1e1 100644 (file)
@@ -1,3 +1,10 @@
+2002-03-21  Loren J. Rittle  <ljrittle@acm.org>
+
+       * include/private/gcconfig.h: Add unified test for FreeBSD.
+       Support FreeBSD/alpha.
+       * os_dep.c: Do not include <machine/trap.h> unless available.
+       (GC_freebsd_stack_base): Fix types.
+
 2002-03-17  Bryce McKinlay  <bryce@waitaki.otago.ac.nz>
 
        * Makefile.am: Make a convenience library.
index e06cc4a..14aa8cb 100644 (file)
 #    define OPENBSD
 # endif
 
+/* And one for FreeBSD: */
+# if defined(__FreeBSD__)
+#    define FREEBSD
+# endif
+
 /* Determine the machine type: */
 # if defined(__XSCALE__)
 #    define ARM32
 # endif
 # if defined(__alpha) || defined(__alpha__)
 #   define ALPHA
-#   if !defined(LINUX) && !defined(NETBSD) && !defined(OPENBSD)
+#   if !defined(LINUX) && !defined(NETBSD) && !defined(OPENBSD) && !defined(FREEBSD)
 #     define OSF1      /* a.k.a Digital Unix */
 #   endif
 #   define mach_type_known
 #   define OPENBSD
 #   define mach_type_known
 # endif
-# if defined(__FreeBSD__) && (defined(i386) || defined(__i386__))
+# if defined(FREEBSD) && (defined(i386) || defined(__i386__))
 #   define I386
-#   define FREEBSD
 #   define mach_type_known
 # endif
 # if defined(__NetBSD__) && (defined(i386) || defined(__i386__))
 #         define DATASTART ((ptr_t) 0x140000000)
 #      endif
 #   endif
+#   ifdef FREEBSD
+#      define OS_TYPE "FREEBSD"
+/* MPROTECT_VDB is not yet supported at all on FreeBSD/alpha. */
+#      define SIG_SUSPEND SIGUSR1
+#      define SIG_THR_RESTART SIGUSR2
+#      define FREEBSD_STACKBOTTOM
+#      ifdef __ELF__
+#          define DYNAMIC_LOADING
+#      endif
+/* Handle unmapped hole alpha*-*-freebsd[45]* puts between etext and edata. */
+       extern char etext;
+       extern char edata;
+       extern char end;
+#      define NEED_FIND_LIMIT
+#      define DATASTART ((ptr_t)(&etext))
+#      define DATAEND (GC_find_limit (DATASTART, TRUE))
+#      define DATASTART2 ((ptr_t)(&edata))
+#      define DATAEND2 ((ptr_t)(&end))
+#      define CPP_WORDSZ 64
+#   endif
 #   ifdef OSF1
 #      define OS_TYPE "OSF1"
 #      define DATASTART ((ptr_t) 0x140000000)
index b8f4cf8..88194fe 100644 (file)
@@ -84,7 +84,7 @@
 #   include <setjmp.h>
 #endif
 
-#ifdef FREEBSD
+#if defined(FREEBSD) && defined(I386)
 #  include <machine/trap.h>
 #endif
 
@@ -747,14 +747,14 @@ ptr_t GC_get_stack_base()
 
   ptr_t GC_freebsd_stack_base(void)
   {
-    int nm[2] = { CTL_KERN, KERN_USRSTACK}, base, len, r;
-    
-    len = sizeof(int);
-    r = sysctl(nm, 2, &base, &len, NULL, 0);
+    int nm[2] = {CTL_KERN, KERN_USRSTACK};
+    ptr_t base;
+    size_t len = sizeof(ptr_t);
+    int r = sysctl(nm, 2, &base, &len, NULL, 0);
     
     if (r) ABORT("Error getting stack base");
 
-    return (ptr_t)base;
+    return base;
   }
 
 #endif /* FREEBSD_STACKBOTTOM */