Back to index

lightning-sunbird  0.9+nobinonly
gcconfig.h
Go to the documentation of this file.
00001 /* 
00002  * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
00003  * Copyright (c) 1991-1994 by Xerox Corporation.  All rights reserved.
00004  * Copyright (c) 1996 by Silicon Graphics.  All rights reserved.
00005  *
00006  * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
00007  * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
00008  *
00009  * Permission is hereby granted to use or copy this program
00010  * for any purpose,  provided the above notices are retained on all copies.
00011  * Permission to modify the code and to distribute modified code is granted,
00012  * provided the above notices are retained, and a notice that the code was
00013  * modified is included with the above copyright notice.
00014  */
00015  
00016 #ifndef CONFIG_H
00017 
00018 # define CONFIG_H
00019 
00020 /* Machine dependent parameters.  Some tuning parameters can be found */
00021 /* near the top of gc_private.h.                               */
00022 
00023 /* Machine specific parts contributed by various people.  See README file. */
00024 
00025 /* First a unified test for Linux: */
00026 # if defined(linux) || defined(__linux__)
00027 #    define LINUX
00028 # endif
00029 
00030 /* Determine the machine type: */
00031 # if defined(sun) && defined(mc68000)
00032 #    define M68K
00033 #    define SUNOS4
00034 #    define mach_type_known
00035 # endif
00036 # if defined(hp9000s300)
00037 #    define M68K
00038 #    define HP
00039 #    define mach_type_known
00040 # endif
00041 # if defined(__OpenBSD__) && defined(m68k)
00042 #    define M68K
00043 #    define OPENBSD
00044 #    define mach_type_known
00045 # endif
00046 # if defined(__NetBSD__) && defined(m68k)
00047 #    define M68K
00048 #    define NETBSD
00049 #    define mach_type_known
00050 # endif
00051 # if defined(vax)
00052 #    define VAX
00053 #    ifdef ultrix
00054 #      define ULTRIX
00055 #    else
00056 #      define BSD
00057 #    endif
00058 #    define mach_type_known
00059 # endif
00060 # if defined(mips) || defined(__mips)
00061 #    define MIPS
00062 #    if defined(ultrix) || defined(__ultrix) || defined(__NetBSD__)
00063 #      define ULTRIX
00064 #    else
00065 #      if defined(_SYSTYPE_SVR4) || defined(SYSTYPE_SVR4) || defined(__SYSTYPE_SVR4__)
00066 #        define IRIX5   /* or IRIX 6.X */
00067 #      else
00068 #        define RISCOS  /* or IRIX 4.X */
00069 #      endif
00070 #    endif
00071 #    define mach_type_known
00072 # endif
00073 # if defined(sequent) && defined(i386)
00074 #    define I386
00075 #    define SEQUENT
00076 #    define mach_type_known
00077 # endif
00078 # if defined(sun) && defined(i386)
00079 #    define I386
00080 #    define SUNOS5
00081 #    define mach_type_known
00082 # endif
00083 # if (defined(__OS2__) || defined(__EMX__)) && defined(__32BIT__)
00084 #    define I386
00085 #    define OS2
00086 #    define mach_type_known
00087 # endif
00088 # if defined(ibm032)
00089 #   define RT
00090 #   define mach_type_known
00091 # endif
00092 # if defined(sun) && (defined(sparc) || defined(__sparc))
00093 #   define SPARC
00094     /* Test for SunOS 5.x */
00095 #     include <errno.h>
00096 #     ifdef ECHRNG
00097 #       define SUNOS5
00098 #     else
00099 #      define SUNOS4
00100 #     endif
00101 #   define mach_type_known
00102 # endif
00103 # if defined(sparc) && defined(unix) && !defined(sun) && !defined(linux)
00104 #   define SPARC
00105 #   define DRSNX
00106 #   define mach_type_known
00107 # endif
00108 # if defined(_IBMR2)
00109 #   define RS6000
00110 #   define mach_type_known
00111 # endif
00112 # if defined(_M_XENIX) && defined(_M_SYSV) && defined(_M_I386)
00113        /* The above test may need refinement     */
00114 #   define I386
00115 #   if defined(_SCO_ELF)
00116 #     define SCO_ELF
00117 #   else
00118 #     define SCO
00119 #   endif
00120 #   define mach_type_known
00121 # endif
00122 # if defined(_AUX_SOURCE)
00123 #   define M68K
00124 #   define SYSV
00125 #   define mach_type_known
00126 # endif
00127 # if defined(_PA_RISC1_0) || defined(_PA_RISC1_1) \
00128      || defined(hppa) || defined(__hppa__)
00129 #   define HP_PA
00130 #   define mach_type_known
00131 # endif
00132 # if defined(LINUX) && defined(i386)
00133 #    define I386
00134 #    define mach_type_known
00135 # endif
00136 # if defined(LINUX) && defined(powerpc)
00137 #    define POWERPC
00138 #    define mach_type_known
00139 # endif
00140 # if defined(LINUX) && defined(__mc68000__)
00141 #    define M68K
00142 #    define mach_type_known
00143 # endif
00144 # if defined(linux) && defined(sparc)
00145 #    define SPARC
00146 #    define LINUX
00147 #    define mach_type_known
00148 # endif
00149 # if defined(__alpha) || defined(__alpha__)
00150 #   define ALPHA
00151 #   if !defined(LINUX)
00152 #     define OSF1    /* a.k.a Digital Unix */
00153 #   endif
00154 #   define mach_type_known
00155 # endif
00156 # if defined(_AMIGA)
00157 #   define M68K
00158 #   define AMIGA
00159 #   define mach_type_known
00160 # endif
00161 # if defined(THINK_C) || defined(__MWERKS__) && !defined(__powerc)
00162 #   define M68K
00163 #   define MACOS
00164 #   define mach_type_known
00165 # endif
00166 # if defined(__MWERKS__) && defined(__powerc)
00167 #   define POWERPC
00168 #   define MACOS
00169 #   define mach_type_known
00170 # endif
00171 # if defined(NeXT) && defined(mc68000)
00172 #   define M68K
00173 #   define NEXT
00174 #   define mach_type_known
00175 # endif
00176 # if defined(NeXT) && defined(i386)
00177 #   define I386
00178 #   define NEXT
00179 #   define mach_type_known
00180 # endif
00181 # if defined(__OpenBSD__) && defined(i386)
00182 #   define I386
00183 #   define OPENBSD
00184 #   define mach_type_known
00185 # endif
00186 # if defined(__FreeBSD__) && defined(i386)
00187 #   define I386
00188 #   define FREEBSD
00189 #   define mach_type_known
00190 # endif
00191 # if defined(__NetBSD__) && defined(i386)
00192 #   define I386
00193 #   define NETBSD
00194 #   define mach_type_known
00195 # endif
00196 # if defined(bsdi) && defined(i386)
00197 #    define I386
00198 #    define BSDI
00199 #    define mach_type_known
00200 # endif
00201 # if !defined(mach_type_known) && defined(__386BSD__)
00202 #   define I386
00203 #   define THREE86BSD
00204 #   define mach_type_known
00205 # endif
00206 # if defined(_CX_UX) && defined(_M88K)
00207 #   define M88K
00208 #   define CX_UX
00209 #   define mach_type_known
00210 # endif
00211 # if defined(DGUX)
00212 #   define M88K
00213     /* DGUX defined */
00214 #   define mach_type_known
00215 # endif
00216 # if (defined(_MSDOS) || defined(_MSC_VER)) && (_M_IX86 >= 300) \
00217      || defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__)
00218 #   define I386
00219 #   define MSWIN32   /* or Win32s */
00220 #   define mach_type_known
00221 # endif
00222 # if defined(__DJGPP__)
00223 #   define I386
00224 #   ifndef DJGPP
00225 #     define DJGPP  /* MSDOS running the DJGPP port of GCC */
00226 #   endif
00227 #   define mach_type_known
00228 # endif
00229 # if defined(__CYGWIN32__) || defined(__CYGWIN__)
00230 #   define I386
00231 #   define CYGWIN32
00232 #   define mach_type_known
00233 # endif
00234 # if defined(__BORLANDC__)
00235 #   define I386
00236 #   define MSWIN32
00237 #   define mach_type_known
00238 # endif
00239 # if defined(_UTS) && !defined(mach_type_known)
00240 #   define S370
00241 #   define UTS4
00242 #   define mach_type_known
00243 # endif
00244 /* Ivan Demakov */
00245 # if defined(__WATCOMC__) && defined(__386__)
00246 #   define I386
00247 #   if !defined(OS2) && !defined(MSWIN32) && !defined(DOS4GW)
00248 #     if defined(__OS2__)
00249 #       define OS2
00250 #     else
00251 #       if defined(__WINDOWS_386__) || defined(__NT__)
00252 #         define MSWIN32
00253 #       else
00254 #         define DOS4GW
00255 #       endif
00256 #     endif
00257 #   endif
00258 #   define mach_type_known
00259 # endif
00260 
00261 /* Feel free to add more clauses here */
00262 
00263 /* Or manually define the machine type here.  A machine type is       */
00264 /* characterized by the architecture.  Some                           */
00265 /* machine types are further subdivided by OS.                        */
00266 /* the macros ULTRIX, RISCOS, and BSD to distinguish.                 */
00267 /* Note that SGI IRIX is treated identically to RISCOS.               */
00268 /* SYSV on an M68K actually means A/UX.                               */
00269 /* The distinction in these cases is usually the stack starting address */
00270 # ifndef mach_type_known
00271        --> unknown machine type
00272 # endif
00273                   /* Mapping is: M68K       ==> Motorola 680X0 */
00274                   /*           (SUNOS4,HP,NEXT, and SYSV (A/UX),      */
00275                   /*           MACOS and AMIGA variants)              */
00276                   /*             I386       ==> Intel 386             */
00277                   /*            (SEQUENT, OS2, SCO, LINUX, NETBSD,    */
00278                   /*             FREEBSD, THREE86BSD, MSWIN32, */
00279                   /*                    BSDI,SUNOS5, NEXT, other variants)   */
00280                     /*             NS32K      ==> Encore Multimax     */
00281                     /*             MIPS       ==> R2000 or R3000      */
00282                     /*                    (RISCOS, ULTRIX variants)   */
00283                     /*                VAX       ==> DEC VAX           */
00284                     /*                    (BSD, ULTRIX variants)             */
00285                     /*                RS6000     ==> IBM RS/6000 AIX3.X      */
00286                     /*                RT        ==> IBM PC/RT         */
00287                     /*                HP_PA      ==> HP9000/700 & /800       */
00288                     /*                             HP/UX                     */
00289                   /*           SPARC      ==> SPARC under SunOS       */
00290                   /*               (SUNOS4, SUNOS5,            */
00291                   /*                DRSNX variants)            */
00292                   /*                  ALPHA      ==> DEC Alpha               */
00293                   /*               (OSF1 and LINUX variants)   */
00294                   /*                  M88K       ==> Motorola 88XX0        */
00295                   /*                       (CX_UX and DGUX)           */
00296                   /*                  S370             ==> 370-like machine  */
00297                   /*                      running Amdahl UTS4         */
00298 
00299 
00300 /*
00301  * For each architecture and OS, the following need to be defined:
00302  *
00303  * CPP_WORD_SZ is a simple integer constant representing the word size.
00304  * in bits.  We assume byte addressibility, where a byte has 8 bits.
00305  * We also assume CPP_WORD_SZ is either 32 or 64.
00306  * (We care about the length of pointers, not hardware
00307  * bus widths.  Thus a 64 bit processor with a C compiler that uses
00308  * 32 bit pointers should use CPP_WORD_SZ of 32, not 64. Default is 32.)
00309  *
00310  * MACH_TYPE is a string representation of the machine type.
00311  * OS_TYPE is analogous for the OS.
00312  *
00313  * ALIGNMENT is the largest N, such that
00314  * all pointer are guaranteed to be aligned on N byte boundaries.
00315  * defining it to be 1 will always work, but perform poorly.
00316  *
00317  * DATASTART is the beginning of the data segment.
00318  * On UNIX systems, the collector will scan the area between DATASTART
00319  * and DATAEND for root pointers.
00320  *
00321  * DATAEND, if not &end.
00322  *
00323  * ALIGN_DOUBLE of GC_malloc should return blocks aligned to twice
00324  * the pointer size.
00325  *
00326  * STACKBOTTOM is the cool end of the stack, which is usually the
00327  * highest address in the stack.
00328  * Under PCR or OS/2, we have other ways of finding thread stacks.
00329  * For each machine, the following should:
00330  * 1) define STACK_GROWS_UP if the stack grows toward higher addresses, and
00331  * 2) define exactly one of
00332  *     STACKBOTTOM (should be defined to be an expression)
00333  *     HEURISTIC1
00334  *     HEURISTIC2
00335  * If either of the last two macros are defined, then STACKBOTTOM is computed
00336  * during collector startup using one of the following two heuristics:
00337  * HEURISTIC1:  Take an address inside GC_init's frame, and round it up to
00338  *            the next multiple of STACK_GRAN.
00339  * HEURISTIC2:  Take an address inside GC_init's frame, increment it repeatedly
00340  *            in small steps (decrement if STACK_GROWS_UP), and read the value
00341  *            at each location.  Remember the value when the first
00342  *            Segmentation violation or Bus error is signalled.  Round that
00343  *            to the nearest plausible page boundary, and use that instead
00344  *            of STACKBOTTOM.
00345  *
00346  * If no expression for STACKBOTTOM can be found, and neither of the above
00347  * heuristics are usable, the collector can still be used with all of the above
00348  * undefined, provided one of the following is done:
00349  * 1) GC_mark_roots can be changed to somehow mark from the correct stack(s)
00350  *    without reference to STACKBOTTOM.  This is appropriate for use in
00351  *    conjunction with thread packages, since there will be multiple stacks.
00352  *    (Allocating thread stacks in the heap, and treating them as ordinary
00353  *    heap data objects is also possible as a last resort.  However, this is
00354  *    likely to introduce significant amounts of excess storage retention
00355  *    unless the dead parts of the thread stacks are periodically cleared.)
00356  * 2) Client code may set GC_stackbottom before calling any GC_ routines.
00357  *    If the author of the client code controls the main program, this is
00358  *    easily accomplished by introducing a new main program, setting
00359  *    GC_stackbottom to the address of a local variable, and then calling
00360  *    the original main program.  The new main program would read something
00361  *    like:
00362  *
00363  *            # include "gc_private.h"
00364  *
00365  *            main(argc, argv, envp)
00366  *            int argc;
00367  *            char **argv, **envp;
00368  *            {
00369  *                int dummy;
00370  *
00371  *                GC_stackbottom = (ptr_t)(&dummy);
00372  *                return(real_main(argc, argv, envp));
00373  *            }
00374  *
00375  *
00376  * Each architecture may also define the style of virtual dirty bit
00377  * implementation to be used:
00378  *   MPROTECT_VDB: Write protect the heap and catch faults.
00379  *   PROC_VDB: Use the SVR4 /proc primitives to read dirty bits.
00380  *
00381  * An architecture may define DYNAMIC_LOADING if dynamic_load.c
00382  * defined GC_register_dynamic_libraries() for the architecture.
00383  */
00384 
00385 
00386 # define STACK_GRAN 0x1000000
00387 # ifdef M68K
00388 #   define MACH_TYPE "M68K"
00389 #   define ALIGNMENT 2
00390 #   ifdef OPENBSD
00391 #      define OS_TYPE "OPENBSD"
00392 #      define HEURISTIC2
00393        extern char etext;
00394 #      define DATASTART ((ptr_t)(&etext))
00395 #   endif
00396 #   ifdef NETBSD
00397 #      define OS_TYPE "NETBSD"
00398 #      define HEURISTIC2
00399        extern char etext;
00400 #      define DATASTART ((ptr_t)(&etext))
00401 #   endif
00402 #   ifdef LINUX
00403 #       define OS_TYPE "LINUX"
00404 #       define STACKBOTTOM ((ptr_t)0xf0000000)
00405 #       define MPROTECT_VDB
00406 #       ifdef __ELF__
00407 #            define DYNAMIC_LOADING
00408              extern char **__environ;
00409 #            define DATASTART ((ptr_t)(&__environ))
00410                              /* hideous kludge: __environ is the first */
00411                              /* word in crt0.o, and delimits the start */
00412                              /* of the data segment, no matter which   */
00413                              /* ld options were passed through.        */
00414                              /* We could use _etext instead, but that  */
00415                              /* would include .rodata, which may       */
00416                              /* contain large read-only data tables    */
00417                              /* that we'd rather not scan.             */
00418              extern int _end;
00419 #            define DATAEND (&_end)
00420 #       else
00421              extern int etext;
00422 #            define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
00423 #       endif
00424 #   endif
00425 #   ifdef SUNOS4
00426 #      define OS_TYPE "SUNOS4"
00427        extern char etext;
00428 #      define DATASTART ((ptr_t)((((word) (&etext)) + 0x1ffff) & ~0x1ffff))
00429 #      define HEURISTIC1    /* differs    */
00430 #      define DYNAMIC_LOADING
00431 #   endif
00432 #   ifdef HP
00433 #      define OS_TYPE "HP"
00434        extern char etext;
00435 #       define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
00436 #       define STACKBOTTOM ((ptr_t) 0xffeffffc)
00437                            /* empirically determined.  seems to work. */
00438 #      include <unistd.h>
00439 #      define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
00440 #   endif
00441 #   ifdef SYSV
00442 #      define OS_TYPE "SYSV"
00443        extern etext;
00444 #      define DATASTART ((ptr_t)((((word) (&etext)) + 0x3fffff) \
00445                                & ~0x3fffff) \
00446                               +((word)&etext & 0x1fff))
00447        /* This only works for shared-text binaries with magic number 0413.
00448           The other sorts of SysV binaries put the data at the end of the text,
00449           in which case the default of &etext would work.  Unfortunately,
00450           handling both would require having the magic-number available.
00451                             -- Parag
00452           */
00453 #      define STACKBOTTOM ((ptr_t)0xFFFFFFFE)
00454                      /* The stack starts at the top of memory, but   */
00455                      /* 0x0 cannot be used as setjump_test complains */
00456                      /* that the stack direction is incorrect.  Two  */
00457                      /* bytes down from 0x0 should be safe enough.   */
00458                      /*            --Parag                            */
00459 #      include <sys/mmu.h>
00460 #      define GETPAGESIZE() PAGESIZE      /* Is this still right? */
00461 #   endif
00462 #   ifdef AMIGA
00463 #      define OS_TYPE "AMIGA"
00464               /* STACKBOTTOM and DATASTART handled specially   */
00465               /* in os_dep.c                                   */
00466 #      define DATAEND       /* not needed */
00467 #      define GETPAGESIZE() 4096
00468 #   endif
00469 #   ifdef MACOS
00470 #     ifndef __LOWMEM__
00471 #     include <LowMem.h>
00472 #     endif
00473 #     define OS_TYPE "MACOS"
00474                      /* see os_dep.c for details of global data segments. */
00475 #     define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
00476 #     define DATAEND /* not needed */
00477 #     define GETPAGESIZE() 4096
00478 #   endif
00479 #   ifdef NEXT
00480 #      define OS_TYPE "NEXT"
00481 #      define DATASTART ((ptr_t) get_etext())
00482 #      define STACKBOTTOM ((ptr_t) 0x4000000)
00483 #      define DATAEND       /* not needed */
00484 #   endif
00485 # endif
00486 
00487 # ifdef POWERPC
00488 #   define MACH_TYPE "POWERPC"
00489 #   define ALIGNMENT 4
00490 #   define ALIGN_DOUBLE
00491 #   ifdef MACOS
00492 #     ifndef __LOWMEM__
00493 #     include <LowMem.h>
00494 #     endif
00495 #     define OS_TYPE "MACOS"
00496                      /* see os_dep.c for details of global data segments. */
00497 #     define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
00498 #     define DATAEND  /* not needed */
00499 #     define THREADS
00500 #     define GENERIC_THREADS
00501 #     define SAVE_CALL_CHAIN
00502 #   endif
00503 #   ifdef LINUX
00504 #     define OS_TYPE "LINUX"
00505 #     define HEURISTIC1
00506 #     undef STACK_GRAN
00507 #     define STACK_GRAN 0x10000000
00508 #     define DATASTART GC_data_start
00509       extern int _end;
00510 #     define DATAEND (&_end)
00511 #   endif
00512 # endif
00513 
00514 # ifdef VAX
00515 #   define MACH_TYPE "VAX"
00516 #   define ALIGNMENT 4      /* Pointers are longword aligned by 4.2 C compiler */
00517     extern char etext;
00518 #   define DATASTART ((ptr_t)(&etext))
00519 #   ifdef BSD
00520 #      define OS_TYPE "BSD"
00521 #      define HEURISTIC1
00522                      /* HEURISTIC2 may be OK, but it's hard to test. */
00523 #   endif
00524 #   ifdef ULTRIX
00525 #      define OS_TYPE "ULTRIX"
00526 #      define STACKBOTTOM ((ptr_t) 0x7fffc800)
00527 #   endif
00528 # endif
00529 
00530 # ifdef RT
00531 #   define MACH_TYPE "RT"
00532 #   define ALIGNMENT 4
00533 #   define DATASTART ((ptr_t) 0x10000000)
00534 #   define STACKBOTTOM ((ptr_t) 0x1fffd800)
00535 # endif
00536 
00537 # ifdef SPARC
00538 #   define MACH_TYPE "SPARC"
00539 #   define ALIGNMENT 4      /* Required by hardware     */
00540 #   define ALIGN_DOUBLE
00541     extern int etext;
00542 #   ifdef SUNOS5
00543 #      define OS_TYPE "SUNOS5"
00544        extern int _etext;
00545        extern int _end;
00546        extern char * GC_SysVGetDataStart();
00547 #       define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
00548 #      define DATAEND (&_end)
00549 #      ifndef USE_MMAP
00550 #          define USE_MMAP
00551 #      endif
00552 #       ifdef USE_MMAP
00553 #         define HEAP_START (ptr_t)0x40000000
00554 #       else
00555 #        define HEAP_START DATAEND
00556 #       endif
00557 #      define PROC_VDB
00558 /*     HEURISTIC1 reportedly no longer works under 2.7.  Thus we      */
00559 /*     switched to HEURISTIC2, eventhough it creates some debugging   */
00560 /*     issues.                                                        */
00561 #      define HEURISTIC2
00562 #      include <unistd.h>
00563 #       define GETPAGESIZE()  sysconf(_SC_PAGESIZE)
00564               /* getpagesize() appeared to be missing from at least one */
00565               /* Solaris 5.4 installation.  Weird.                      */
00566 #      define DYNAMIC_LOADING
00567 #   endif
00568 #   ifdef SUNOS4
00569 #      define OS_TYPE "SUNOS4"
00570        /* [If you have a weak stomach, don't read this.]              */
00571        /* We would like to use:                                */
00572 /* #       define DATASTART ((ptr_t)((((word) (&etext)) + 0x1fff) & ~0x1fff)) */
00573        /* This fails occasionally, due to an ancient, but very        */
00574        /* persistent ld bug.  &etext is set 32 bytes too high.        */
00575        /* We instead read the text segment size from the a.out        */
00576        /* header, which happens to be mapped into our address space   */
00577        /* at the start of the text segment.  The detective work here  */
00578        /* was done by Robert Ehrlich, Manuel Serrano, and Bernard     */
00579        /* Serpette of INRIA.                                          */
00580        /* This assumes ZMAGIC, i.e. demand-loadable executables.      */
00581 #      define TEXTSTART 0x2000
00582 #       define DATASTART ((ptr_t)(*(int *)(TEXTSTART+0x4)+TEXTSTART))
00583 #      define MPROTECT_VDB
00584 #      define HEURISTIC1
00585 #      define DYNAMIC_LOADING
00586 #   endif
00587 #   ifdef DRSNX
00588 #       define CPP_WORDSZ 32
00589 #      define OS_TYPE "DRSNX"
00590        extern char * GC_SysVGetDataStart();
00591        extern int etext;
00592 #       define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &etext)
00593 #      define MPROTECT_VDB
00594 #       define STACKBOTTOM ((ptr_t) 0xdfff0000)
00595 #      define DYNAMIC_LOADING
00596 #   endif
00597 #   ifdef LINUX
00598 #     define OS_TYPE "LINUX"
00599 #     ifdef __ELF__
00600 #         define DATASTART GC_data_start
00601 #         define DYNAMIC_LOADING
00602 #     else
00603           Linux Sparc non elf ?
00604 #     endif
00605       extern int _end;
00606 #     define DATAEND (&_end)
00607 #     define SVR4
00608 #     define STACKBOTTOM ((ptr_t) 0xf0000000)
00609 #   endif
00610 # endif
00611 
00612 # ifdef I386
00613 #   define MACH_TYPE "I386"
00614 #   define ALIGNMENT 4      /* Appears to hold for all "32 bit" compilers    */
00615                      /* except Borland.  The -a4 option fixes  */
00616                      /* Borland.                               */
00617                         /* Ivan Demakov: For Watcom the option is -zp4. */
00618 #   ifndef SMALL_CONFIG
00619 #     define ALIGN_DOUBLE /* Not strictly necessary, but may give speed   */
00620                        /* improvement on Pentiums.                      */
00621 #   endif
00622 #   ifdef SEQUENT
00623 #      define OS_TYPE "SEQUENT"
00624        extern int etext;
00625 #       define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
00626 #       define STACKBOTTOM ((ptr_t) 0x3ffff000) 
00627 #   endif
00628 #   ifdef SUNOS5
00629 #      define OS_TYPE "SUNOS5"
00630        extern int etext, _start;
00631        extern char * GC_SysVGetDataStart();
00632 #       define DATASTART GC_SysVGetDataStart(0x1000, &etext)
00633 #      define STACKBOTTOM ((ptr_t)(&_start))
00634 
00635 /*#    define PROC_VDB*/
00636 #      define DYNAMIC_LOADING
00637 #      ifndef USE_MMAP
00638 #          define USE_MMAP
00639 #      endif
00640 #       ifdef USE_MMAP
00641 #         define HEAP_START (ptr_t)0x40000000
00642 #       else
00643 #        define HEAP_START DATAEND
00644 #       endif
00645 #   endif
00646 #   ifdef SCO
00647 #      define OS_TYPE "SCO"
00648        extern int etext;
00649 #      define DATASTART ((ptr_t)((((word) (&etext)) + 0x3fffff) \
00650                               & ~0x3fffff) \
00651                              +((word)&etext & 0xfff))
00652 #      define STACKBOTTOM ((ptr_t) 0x7ffffffc)
00653 #   endif
00654 #   ifdef SCO_ELF
00655 #       define OS_TYPE "SCO_ELF"
00656         extern int etext;
00657 #       define DATASTART ((ptr_t)(&etext))
00658 #       define STACKBOTTOM ((ptr_t) 0x08048000)
00659 #       define DYNAMIC_LOADING
00660 #      define ELF_CLASS ELFCLASS32
00661 #   endif
00662 #   ifdef LINUX
00663 #      define OS_TYPE "LINUX"
00664 #      define STACKBOTTOM ((ptr_t)0xbffffb44) /* address of argv */
00665        /* Appears to be 0xe0000000 for at least one 2.1.91 kernel.    */
00666        /* Probably needs to be more flexible, but I don't yet         */
00667        /* fully understand how flexible.                       */
00668 #       if !defined(LINUX_THREADS) || !defined(REDIRECT_MALLOC)
00669 #          define MPROTECT_VDB
00670 #      else
00671            /* We seem to get random errors in incremental mode,       */
00672            /* possibly because Linux threads is itself a malloc client */
00673            /* and can't deal with the signals.                        */
00674 #      endif
00675 #       ifdef __ELF__
00676 #            define DYNAMIC_LOADING
00677 #           ifdef UNDEFINED /* includes ro data */
00678               extern int _etext;
00679 #              define DATASTART ((ptr_t)((((word) (&_etext)) + 0xfff) & ~0xfff))
00680 #           endif
00681 #           include <features.h>
00682 #           if defined(__GLIBC__) && __GLIBC__ >= 2
00683                extern int __data_start;
00684 #              define DATASTART ((ptr_t)(&__data_start))
00685 #           else
00686                 extern char **__environ;
00687 #                define DATASTART ((ptr_t)(&__environ))
00688                            /* hideous kludge: __environ is the first */
00689                            /* word in crt0.o, and delimits the start */
00690                            /* of the data segment, no matter which   */
00691                            /* ld options were passed through.        */
00692                            /* We could use _etext instead, but that  */
00693                            /* would include .rodata, which may       */
00694                            /* contain large read-only data tables    */
00695                            /* that we'd rather not scan.              */
00696 #           endif
00697             extern int _end;
00698 #           define DATAEND (&_end)
00699 #      else
00700             extern int etext;
00701 #            define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
00702 #       endif
00703 #   endif
00704 #   ifdef CYGWIN32
00705 #       define OS_TYPE "CYGWIN32"
00706           extern int _data_start__;
00707           extern int _data_end__;
00708           extern int _bss_start__;
00709           extern int _bss_end__;
00710        /* For binutils 2.9.1, we have                   */
00711        /*     DATASTART   = _data_start__        */
00712        /*     DATAEND           = _bss_end__            */
00713        /* whereas for some earlier versions it was      */
00714        /*     DATASTART   = _bss_start__         */
00715        /*     DATAEND           = _data_end__           */
00716        /* To get it right for both, we take the  */
00717        /* minumum/maximum of the two.                   */
00718 #      define MAX(x,y) ((x) > (y) ? (x) : (y))
00719 #      define MIN(x,y) ((x) < (y) ? (x) : (y))
00720 #       define DATASTART ((ptr_t) MIN(&_data_start__, &_bss_start__))
00721 #       define DATAEND       ((ptr_t) MAX(&_data_end__, &_bss_end__))
00722 #      undef STACK_GRAN
00723 #       define STACK_GRAN 0x10000
00724 #       define HEURISTIC1
00725 #   endif
00726 #   ifdef OS2
00727 #      define OS_TYPE "OS2"
00728               /* STACKBOTTOM and DATASTART are handled specially in   */
00729               /* os_dep.c. OS2 actually has the right                 */
00730               /* system call!                                         */
00731 #      define DATAEND       /* not needed */
00732 #   endif
00733 #   ifdef MSWIN32
00734 #      define OS_TYPE "MSWIN32"
00735               /* STACKBOTTOM and DATASTART are handled specially in   */
00736               /* os_dep.c.                                     */
00737 #       ifndef __WATCOMC__
00738 #        define MPROTECT_VDB
00739 #      endif
00740 #       define DATAEND  /* not needed */
00741 #   endif
00742 #   ifdef DJGPP
00743 #       define OS_TYPE "DJGPP"
00744 #       include "stubinfo.h"
00745         extern int etext;
00746         extern int _stklen;
00747         extern int __djgpp_stack_limit;
00748 #       define DATASTART ((ptr_t)((((word) (&etext)) + 0x1ff) & ~0x1ff))
00749 /* #       define STACKBOTTOM ((ptr_t)((word) _stubinfo + _stubinfo->size \
00750                                                      + _stklen)) */
00751 #       define STACKBOTTOM ((ptr_t)((word) __djgpp_stack_limit + _stklen))
00752               /* This may not be right.  */
00753 #   endif
00754 #   ifdef OPENBSD
00755 #      define OS_TYPE "OPENBSD"
00756 #   endif
00757 #   ifdef FREEBSD
00758 #      define OS_TYPE "FREEBSD"
00759 #      define MPROTECT_VDB
00760 #   endif
00761 #   ifdef NETBSD
00762 #      define OS_TYPE "NETBSD"
00763 #   endif
00764 #   ifdef THREE86BSD
00765 #      define OS_TYPE "THREE86BSD"
00766 #   endif
00767 #   ifdef BSDI
00768 #      define OS_TYPE "BSDI"
00769 #   endif
00770 #   if defined(OPENBSD) || defined(FREEBSD) || defined(NETBSD) \
00771         || defined(THREE86BSD) || defined(BSDI)
00772 #      define HEURISTIC2
00773        extern char etext;
00774 #      define DATASTART ((ptr_t)(&etext))
00775 #   endif
00776 #   ifdef NEXT
00777 #      define OS_TYPE "NEXT"
00778 #      define DATASTART ((ptr_t) get_etext())
00779 #      define STACKBOTTOM ((ptr_t)0xc0000000)
00780 #      define DATAEND       /* not needed */
00781 #   endif
00782 #   ifdef DOS4GW
00783 #     define OS_TYPE "DOS4GW"
00784       extern long __nullarea;
00785       extern char _end;
00786       extern char *_STACKTOP;
00787       /* Depending on calling conventions Watcom C either precedes
00788          or does not precedes with undescore names of C-variables.
00789          Make sure startup code variables always have the same names.  */
00790       #pragma aux __nullarea "*";
00791       #pragma aux _end "*";
00792 #     define STACKBOTTOM ((ptr_t) _STACKTOP)
00793                          /* confused? me too. */
00794 #     define DATASTART ((ptr_t) &__nullarea)
00795 #     define DATAEND ((ptr_t) &_end)
00796 #   endif
00797 # endif
00798 
00799 # ifdef NS32K
00800 #   define MACH_TYPE "NS32K"
00801 #   define ALIGNMENT 4
00802     extern char **environ;
00803 #   define DATASTART ((ptr_t)(&environ))
00804                            /* hideous kludge: environ is the first   */
00805                            /* word in crt0.o, and delimits the start */
00806                            /* of the data segment, no matter which   */
00807                            /* ld options were passed through.        */
00808 #   define STACKBOTTOM ((ptr_t) 0xfffff000) /* for Encore */
00809 # endif
00810 
00811 # ifdef MIPS
00812 #   define MACH_TYPE "MIPS"
00813 #   ifndef IRIX5
00814 #     define DATASTART (ptr_t)0x10000000
00815                            /* Could probably be slightly higher since */
00816                            /* startup code allocates lots of stuff.   */
00817 #   else
00818       extern int _fdata;
00819 #     define DATASTART ((ptr_t)(&_fdata))
00820 #     ifdef USE_MMAP
00821 #         define HEAP_START (ptr_t)0x30000000
00822 #     else
00823 #        define HEAP_START DATASTART
00824 #     endif
00825                            /* Lowest plausible heap address.          */
00826                            /* In the MMAP case, we map there.  */
00827                            /* In either case it is used to identify   */
00828                            /* heap sections so they're not            */
00829                            /* considered as roots.                    */
00830 #   endif /* IRIX5 */
00831 #   define HEURISTIC2
00832 /* #   define STACKBOTTOM ((ptr_t)0x7fff8000)  sometimes also works.  */
00833 #   ifdef ULTRIX
00834 #      define OS_TYPE "ULTRIX"
00835 #       define ALIGNMENT 4
00836 #   endif
00837 #   ifdef RISCOS
00838 #      define OS_TYPE "RISCOS"
00839 #      define ALIGNMENT 4  /* Required by hardware */
00840 #   endif
00841 #   ifdef IRIX5
00842 #      define OS_TYPE "IRIX5"
00843 #       define MPROTECT_VDB
00844 #       ifdef _MIPS_SZPTR
00845 #        define CPP_WORDSZ _MIPS_SZPTR
00846 #        define ALIGNMENT (_MIPS_SZPTR/8)
00847 #        if CPP_WORDSZ != 64
00848 #          define ALIGN_DOUBLE
00849 #        endif
00850 #      else
00851 #         define ALIGNMENT 4
00852 #        define ALIGN_DOUBLE
00853 #      endif
00854 #      define DYNAMIC_LOADING
00855 #   endif
00856 # endif
00857 
00858 # ifdef RS6000
00859 #   define MACH_TYPE "RS6000"
00860 #   define ALIGNMENT 4
00861 #   define DATASTART ((ptr_t)0x20000000)
00862     extern int errno;
00863 #   define STACKBOTTOM ((ptr_t)((ulong)&errno))
00864 #   define DYNAMIC_LOADING
00865        /* For really old versions of AIX, this may have to be removed. */
00866 # endif
00867 
00868 # ifdef HP_PA
00869 #   define MACH_TYPE "HP_PA"
00870 #   define ALIGNMENT 4
00871 #   define ALIGN_DOUBLE
00872     extern int __data_start;
00873 #   define DATASTART ((ptr_t)(&__data_start))
00874 #   if 0
00875        /* The following appears to work for 7xx systems running HP/UX */
00876        /* 9.xx Furthermore, it might result in much faster            */
00877        /* collections than HEURISTIC2, which may involve scanning     */
00878        /* segments that directly precede the stack.  It is not the    */
00879        /* default, since it may not work on older machine/OS          */
00880        /* combinations. (Thanks to Raymond X.T. Nijssen for uncovering       */
00881        /* this.)                                               */
00882 #       define STACKBOTTOM ((ptr_t) 0x7b033000)  /* from /etc/conf/h/param.h */
00883 #   else
00884 #       define HEURISTIC2
00885 #   endif
00886 #   define STACK_GROWS_UP
00887 #   define DYNAMIC_LOADING
00888 #   include <unistd.h>
00889 #   define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
00890        /* They misspelled the Posix macro?       */
00891 # endif
00892 
00893 # ifdef ALPHA
00894 #   define MACH_TYPE "ALPHA"
00895 #   define ALIGNMENT 8
00896 #   ifdef OSF1
00897 #      define OS_TYPE "OSF1"
00898 #      define DATASTART ((ptr_t) 0x140000000)
00899        extern _end;
00900 #      define DATAEND ((ptr_t) &_end)
00901 #      define HEURISTIC2
00902        /* Normally HEURISTIC2 is too conervative, since        */
00903        /* the text segment immediately follows the stack.             */
00904        /* Hence we give an upper pound.                        */
00905        extern int __start;
00906 #      define HEURISTIC2_LIMIT ((ptr_t)((word)(&__start) & ~(getpagesize()-1)))
00907 #      define CPP_WORDSZ 64
00908 #      define MPROTECT_VDB
00909 #      define DYNAMIC_LOADING
00910 #   endif
00911 #   ifdef LINUX
00912 #       define OS_TYPE "LINUX"
00913 #       define CPP_WORDSZ 64
00914 #       define STACKBOTTOM ((ptr_t) 0x120000000)
00915 #       ifdef __ELF__
00916             extern int __data_start;
00917 #           define DATASTART &__data_start
00918 #           define DYNAMIC_LOADING
00919 #       else
00920 #           define DATASTART ((ptr_t) 0x140000000)
00921 #       endif
00922        extern int _end;
00923 #      define DATAEND (&_end)
00924 #      define MPROTECT_VDB
00925               /* Has only been superficially tested.  May not  */
00926               /* work on all versions.                  */
00927 #   endif
00928 # endif
00929 
00930 # ifdef M88K
00931 #   define MACH_TYPE "M88K"
00932 #   define ALIGNMENT 4
00933 #   define ALIGN_DOUBLE
00934     extern int etext;
00935 #   ifdef CX_UX
00936 #      define OS_TYPE "CX_UX"
00937 #       define DATASTART ((((word)&etext + 0x3fffff) & ~0x3fffff) + 0x10000)
00938 #   endif
00939 #   ifdef  DGUX
00940 #      define OS_TYPE "DGUX"
00941        extern char * GC_SysVGetDataStart();
00942 #       define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &etext)
00943 #   endif
00944 #   define STACKBOTTOM ((char*)0xf0000000) /* determined empirically */
00945 # endif
00946 
00947 # ifdef S370
00948 #   define MACH_TYPE "S370"
00949 #   define OS_TYPE "UTS4"
00950 #   define ALIGNMENT 4      /* Required by hardware     */
00951     extern int etext;
00952        extern int _etext;
00953        extern int _end;
00954        extern char * GC_SysVGetDataStart();
00955 #       define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
00956 #      define DATAEND (&_end)
00957 #      define HEURISTIC2
00958 # endif
00959 
00960 # ifndef STACK_GROWS_UP
00961 #   define STACK_GROWS_DOWN
00962 # endif
00963 
00964 # ifndef CPP_WORDSZ
00965 #   define CPP_WORDSZ 32
00966 # endif
00967 
00968 # ifndef OS_TYPE
00969 #   define OS_TYPE ""
00970 # endif
00971 
00972 # ifndef DATAEND
00973     extern int end;
00974 #   define DATAEND (&end)
00975 # endif
00976 
00977 # if defined(SVR4) && !defined(GETPAGESIZE)
00978 #    include <unistd.h>
00979 #    define GETPAGESIZE()  sysconf(_SC_PAGESIZE)
00980 # endif
00981 
00982 # ifndef GETPAGESIZE
00983 #   if defined(SUNOS5) || defined(IRIX5)
00984 #      include <unistd.h>
00985 #   endif
00986 #   define GETPAGESIZE() getpagesize()
00987 # endif
00988 
00989 # if defined(SUNOS5) || defined(DRSNX) || defined(UTS4)
00990     /* OS has SVR4 generic features.  Probably others also qualify.   */
00991 #   define SVR4
00992 # endif
00993 
00994 # if defined(SUNOS5) || defined(DRSNX)
00995     /* OS has SUNOS5 style semi-undocumented interface to dynamic     */
00996     /* loader.                                                        */
00997 #   define SUNOS5DL
00998     /* OS has SUNOS5 style signal handlers.                           */
00999 #   define SUNOS5SIGS
01000 # endif
01001 
01002 # if CPP_WORDSZ != 32 && CPP_WORDSZ != 64
01003    -> bad word size
01004 # endif
01005 
01006 # ifdef PCR
01007 #   undef DYNAMIC_LOADING
01008 #   undef STACKBOTTOM
01009 #   undef HEURISTIC1
01010 #   undef HEURISTIC2
01011 #   undef PROC_VDB
01012 #   undef MPROTECT_VDB
01013 #   define PCR_VDB
01014 # endif
01015 
01016 # ifdef SRC_M3
01017 /* Postponed for now. */
01018 #   undef PROC_VDB
01019 #   undef MPROTECT_VDB
01020 # endif
01021 
01022 # ifdef SMALL_CONFIG
01023 /* Presumably not worth the space it takes. */
01024 #   undef PROC_VDB
01025 #   undef MPROTECT_VDB
01026 # endif
01027 
01028 # if !defined(PCR_VDB) && !defined(PROC_VDB) && !defined(MPROTECT_VDB)
01029 #   define DEFAULT_VDB
01030 # endif
01031 
01032 # if defined(_SOLARIS_PTHREADS) && !defined(SOLARIS_THREADS)
01033 #   define SOLARIS_THREADS
01034 # endif
01035 # if defined(IRIX_THREADS) && !defined(IRIX5)
01036 --> inconsistent configuration
01037 # endif
01038 # if defined(IRIX_JDK_THREADS) && !defined(IRIX5)
01039 --> inconsistent configuration
01040 # endif
01041 # if defined(LINUX_THREADS) && !defined(LINUX)
01042 --> inconsistent configuration
01043 # endif
01044 # if defined(SOLARIS_THREADS) && !defined(SUNOS5)
01045 --> inconsistent configuration
01046 # endif
01047 # if defined(PCR) || defined(SRC_M3) || \
01048        defined(SOLARIS_THREADS) || defined(WIN32_THREADS) || \
01049        defined(IRIX_THREADS) || defined(LINUX_THREADS) || \
01050        defined(IRIX_JDK_THREADS)
01051 #   define THREADS
01052 # endif
01053 
01054 # if defined(HP_PA) || defined(M88K) \
01055      || (defined(I386) && defined(OS2)) || defined(UTS4) || defined(LINT) || defined(POWERPC)
01056        /* Use setjmp based hack to mark from callee-save registers. */
01057 #      define USE_GENERIC_PUSH_REGS
01058 # endif
01059 # if defined(SPARC) && !defined(LINUX)
01060 #   define SAVE_CALL_CHAIN
01061 #   define ASM_CLEAR_CODE   /* Stack clearing is crucial, and we      */
01062                             /* include assembly code to do it well.   */
01063 # endif
01064 
01065 # endif