This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

boehm-gc alpha*-*-freebsd* configuration patch


I wrote this yesterday along with a non-working version of this patch:

> DATASTART and DATAEND are both defined as FreeBSD/i386.  I have not
> fully investigated whether merely using DATASTART2 and DATAEND2 is
> enough to solve the problem.

Luckily, setting up to use DATASTART2/DATAEND2 in addition to a
tweaked DATASTART/DATAEND was enough.  This is an update of the
non-working version posted yesterday.  I have verified that only one
unmapped memory region will ever exist between etext and edata on this
port (at least, with the standard linker layout map).

Rebuilt boehm-gc on i386-*-freebsd4.5 (default threaded configuration
only), alpha-*-freebsd4.2 (both threaded and non-threaded
configuration), alpha-*-freebsd5.0 (default threaded configuration
only).  `make check' passed in all cases.  I hope I didn't presume too
much, but I applied to mainline since this is only a configuration
patch for an otherwise non-operational port and, the memory hole issue
aside, is almost identical to the configuration used by i386-*-freebsd*.
With one exception to ensure we don't get OSF1 defined, it only
affects things inside FreeBSD-related macro-guarded regions.

	* 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.

Index: include/private/gcconfig.h
===================================================================
RCS file: /cvs/gcc/gcc/boehm-gc/include/private/gcconfig.h,v
retrieving revision 1.11
diff -c -r1.11 gcconfig.h
*** gcconfig.h	2002/02/12 04:37:57	1.11
--- gcconfig.h	2002/03/22 02:01:15
***************
*** 38,43 ****
--- 38,48 ----
  #    define OPENBSD
  # endif
  
+ /* And one for FreeBSD: */
+ # if defined(__FreeBSD__)
+ #    define FREEBSD
+ # endif
+ 
  /* Determine the machine type: */
  # if defined(__XSCALE__)
  #    define ARM32
***************
*** 214,220 ****
  # endif
  # if defined(__alpha) || defined(__alpha__)
  #   define ALPHA
! #   if !defined(LINUX) && !defined(NETBSD) && !defined(OPENBSD)
  #     define OSF1	/* a.k.a Digital Unix */
  #   endif
  #   define mach_type_known
--- 219,225 ----
  # endif
  # if defined(__alpha) || defined(__alpha__)
  #   define ALPHA
! #   if !defined(LINUX) && !defined(NETBSD) && !defined(OPENBSD) && !defined(FREEBSD)
  #     define OSF1	/* a.k.a Digital Unix */
  #   endif
  #   define mach_type_known
***************
*** 262,270 ****
  #   define OPENBSD
  #   define mach_type_known
  # endif
! # if defined(__FreeBSD__) && (defined(i386) || defined(__i386__))
  #   define I386
- #   define FREEBSD
  #   define mach_type_known
  # endif
  # if defined(__NetBSD__) && (defined(i386) || defined(__i386__))
--- 267,274 ----
  #   define OPENBSD
  #   define mach_type_known
  # endif
! # if defined(FREEBSD) && (defined(i386) || defined(__i386__))
  #   define I386
  #   define mach_type_known
  # endif
  # if defined(__NetBSD__) && (defined(i386) || defined(__i386__))
***************
*** 1329,1334 ****
--- 1333,1358 ----
  #       else		/* ECOFF, until OpenBSD/Alpha 2.7 */
  #   	   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"
Index: os_dep.c
===================================================================
RCS file: /cvs/gcc/gcc/boehm-gc/os_dep.c,v
retrieving revision 1.22
diff -c -r1.22 os_dep.c
*** os_dep.c	2002/03/12 19:06:36	1.22
--- os_dep.c	2002/03/22 02:01:15
***************
*** 84,90 ****
  #   include <setjmp.h>
  #endif
  
! #ifdef FREEBSD
  #  include <machine/trap.h>
  #endif
  
--- 84,90 ----
  #   include <setjmp.h>
  #endif
  
! #if defined(FREEBSD) && defined(I386)
  #  include <machine/trap.h>
  #endif
  
***************
*** 747,760 ****
  
    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);
-     
      if (r) ABORT("Error getting stack base");
  
!     return (ptr_t)base;
    }
  
  #endif /* FREEBSD_STACKBOTTOM */
--- 747,760 ----
  
    ptr_t GC_freebsd_stack_base(void)
    {
!     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 base;
    }
  
  #endif /* FREEBSD_STACKBOTTOM */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]