C:/Users/Dennis/src/lang/russell.orig/src/gc/config.h

Go to the documentation of this file.
00001 #ifndef CONFIG_H
00002 
00003 # define CONFIG_H
00004 
00005 /* Machine dependent parameters.  Some tuning parameters can be found   */
00006 /* near the top of gc_private.h.                                        */
00007 
00008 /* Machine specific parts contributed by various people.  See README file. */
00009 
00010 /* Determine the machine type: */
00011 # if defined(sun) && defined(mc68000)
00012 #    define M68K
00013 #    define SUNOS
00014 #    define mach_type_known
00015 # endif
00016 # if defined(hp9000s300)
00017 #    define M68K
00018 #    define HP
00019 #    define mach_type_known
00020 # endif
00021 # if defined(vax)
00022 #    define VAX
00023 #    ifdef ultrix
00024 #       define ULTRIX
00025 #    else
00026 #       define BSD
00027 #    endif
00028 #    define mach_type_known
00029 # endif
00030 # if defined(mips)
00031 #    define MIPS
00032 #    ifdef ultrix
00033 #       define ULTRIX
00034 #    else
00035 #       define RISCOS
00036 #    endif
00037 #    define mach_type_known
00038 # endif
00039 # if defined(sequent) && defined(i386)
00040 #    define I386
00041 #    define SEQUENT
00042 #    define mach_type_known
00043 # endif
00044 # if defined(sun) && defined(i386)
00045 #    define I386
00046 #    define SUNOS5
00047 #    define mach_type_known
00048 # endif
00049 # if defined(__OS2__) && defined(__32BIT__)
00050 #    define I386
00051 #    define OS2
00052 #    define mach_type_known
00053 # endif
00054 # if defined(ibm032)
00055 #   define RT
00056 #   define mach_type_known
00057 # endif
00058 # if defined(sun) && defined(sparc)
00059 #   define SPARC
00060     /* Test for SunOS 5.x */
00061 #     include <errno.h>
00062 #     ifdef ECHRNG
00063 #       define SUNOS5
00064 #     else
00065 #       define SUNOS4
00066 #     endif
00067 #   define mach_type_known
00068 # endif
00069 # if defined(_IBMR2)
00070 #   define IBMRS6000
00071 #   define mach_type_known
00072 # endif
00073 # if defined(SCO)
00074 #   define I386
00075 #   define SCO
00076 #   define mach_type_known
00077 /*      --> incompletely implemented */
00078 # endif
00079 # if defined(_AUX_SOURCE)
00080 #   define M68K
00081 #   define SYSV
00082 #   define mach_type_known
00083 # endif
00084 # if defined(_PA_RISC1_0) || defined(_PA_RISC1_1)
00085 #   define HP_PA
00086 #   define mach_type_known
00087 # endif
00088 # if defined(linux) && defined(i386)
00089 #    define I386
00090 #    define LINUX
00091 #    define mach_type_known
00092 # endif
00093 
00094 /* Feel free to add more clauses here */
00095 
00096 /* Or manually define the machine type here.  A machine type is         */
00097 /* characterized by the architecture.  Some                             */
00098 /* machine types are further subdivided by OS.                          */
00099 /* the macros ULTRIX, RISCOS, and BSD to distinguish.                   */
00100 /* Note that SGI IRIX is treated identically to RISCOS.                 */
00101 /* SYSV on an M68K actually means A/UX.                                 */
00102 /* The distinction in these cases is usually the stack starting address */
00103 # ifndef mach_type_known
00104         --> unknown machine type
00105 # endif
00106                     /* Mapping is: M68K       ==> Motorola 680X0        */
00107                     /*             (SUNOS, HP, and SYSV (A/UX) variants)*/
00108                     /*             M68K_HP    ==> HP9000/300            */
00109                     /*             M68K_SYSV  ==> A/UX, maybe others    */
00110                     /*             I386       ==> Intel 386             */
00111                     /*              (SEQUENT, OS2, SCO, LINUX variants) */
00112                     /*               SCO is incomplete.                 */
00113                     /*             NS32K      ==> Encore Multimax       */
00114                     /*             MIPS       ==> R2000 or R3000        */
00115                     /*                  (RISCOS, ULTRIX variants)       */
00116                     /*             VAX        ==> DEC VAX               */
00117                     /*                  (BSD, ULTRIX variants)          */
00118                     /*             RS6000     ==> IBM RS/6000 AIX3.1    */
00119                     /*             RT         ==> IBM PC/RT             */
00120                     /*             HP_PA      ==> HP9000/700 & /800     */
00121                     /*                            HP/UX                 */
00122                     /*             SPARC      ==> SPARC under SunOS     */
00123                     /*                  (SUNOS4, SUNOS5 variants)
00124 
00125 
00126 /*
00127  * For each architecture and OS, the following need to be defined:
00128  *
00129  * CPP_WORD_SZ is a simple integer constant representing the word size.
00130  * in bits.  We assume byte addressibility, where a byte has 8 bits.
00131  * We also assume CPP_WORD_SZ is either 32 or 64.  Only 32 is completely
00132  * implemented.  (We care about the length of pointers, not hardware
00133  * bus widths.  Thus a 64 bit processor with a C compiler that uses
00134  * 32 bit pointers should use CPP_WORD_SZ of 32, not 64.)
00135  *
00136  * MACH_TYPE is a string representation of the machine type.
00137  * OS_TYPE is analogous for the OS.
00138  *
00139  * ALIGNMENT is the largest N, such that
00140  * all pointer are guaranteed to be aligned on N byte boundaries.
00141  * defining it to be 1 will always work, but perform poorly.
00142  *
00143  * DATASTART is the beginning of the data segment.
00144  * On UNIX systems, the collector will scan the area between DATASTART
00145  * and &end for root pointers.
00146  *
00147  * STACKBOTTOM is the cool end of the stack, which is usually the
00148  * highest address in the stack.
00149  * Under PCR or OS/2, we have other ways of finding thread stacks.
00150  * For each machine, the following should:
00151  * 1) define STACK_GROWS_UP if the stack grows toward higher addresses, and
00152  * 2) define exactly one of
00153  *      STACKBOTTOM (should be defined to be an expression)
00154  *      HEURISTIC1
00155  *      HEURISTIC2
00156  * If either of the last two macros are defined, then STACKBOTTOM is computed
00157  * during collector startup using one of the following two heuristics:
00158  * HEURISTIC1:  Take an address inside GC_init's frame, and round it up to
00159  *              the next multiple of 16 MB.
00160  * HEURISTIC2:  Take an address inside GC_init's frame, increment it repeatedly
00161  *              in small steps (decrement if STACK_GROWS_UP), and read the value
00162  *              at each location.  Remember the value when the first
00163  *              Segmentation violation or Bus error is signalled.  Round that
00164  *              to the nearest plausible page boundary, and use that instead
00165  *              of STACKBOTTOM.
00166  *
00167  * If no expression for STACKBOTTOM can be found, and neither of the above
00168  * heuristics are usable, the collector can still be used with all of the above
00169  * undefined, provided one of the following is done:
00170  * 1) GC_mark_roots can be changed to somehow mark from the correct stack(s)
00171  *    without reference to STACKBOTTOM.  This is appropriate for use in
00172  *    conjunction with thread packages, since there will be multiple stacks.
00173  *    (Allocating thread stacks in the heap, and treating them as ordinary
00174  *    heap data objects is also possible as a last resort.  However, this is
00175  *    likely to introduce significant amounts of excess storage retention
00176  *    unless the dead parts of the thread stacks are periodically cleared.)
00177  * 2) Client code may set GC_stackbottom before calling any GC_ routines.
00178  *    If the author of the client code controls the main program, this is
00179  *    easily accomplished by introducing a new main program, setting
00180  *    GC_stackbottom to the address of a local variable, and then calling
00181  *    the original main program.  The new main program would read something
00182  *    like:
00183  *
00184  *              # include "gc_private.h"
00185  *
00186  *              main(argc, argv, envp)
00187  *              int argc;
00188  *              char **argv, **envp;
00189  *              {
00190  *                  int dummy;
00191  *
00192  *                  GC_stackbottom = (ptr_t)(&dummy);
00193  *                  return(real_main(argc, argv, envp));
00194  *              }
00195  */
00196 
00197 
00198 # ifdef M68K
00199 #   define MACH_TYPE "M68K"
00200 #   define ALIGNMENT 2
00201 #   ifdef SUNOS
00202 #       define OS_TYPE "SUNOS"
00203         extern char etext;
00204 #       define DATASTART ((ptr_t)((((word) (&etext)) + 0x1ffff) & ~0x1ffff))
00205 #       define HEURISTIC1       /* differs      */
00206 #   endif
00207 #   ifdef HP
00208 #       define OS_TYPE "HP"
00209         extern char etext;
00210 #       define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
00211 #       define STACKBOTTOM ((ptr_t) 0xffeffffc)
00212                               /* empirically determined.  seems to work. */
00213 #   endif
00214 #   ifdef SYSV
00215 #       define OS_TYPE "SYSV"
00216         extern etext;
00217 #       define DATASTART ((ptr_t)((((word) (&etext)) + 0x3fffff) \
00218                                    & ~0x3fffff) \
00219                                   +((word)&etext & 0x1fff))
00220         /* This only works for shared-text binaries with magic number 0413.
00221            The other sorts of SysV binaries put the data at the end of the text,
00222            in which case the default of &etext would work.  Unfortunately,
00223            handling both would require having the magic-number available.
00224                                 -- Parag
00225            */
00226 #       define STACKBOTTOM ((ptr_t)0xFFFFFFFE)
00227                         /* The stack starts at the top of memory, but   */
00228                         /* 0x0 cannot be used as setjump_test complains */
00229                         /* that the stack direction is incorrect.  Two  */
00230                         /* bytes down from 0x0 should be safe enough.   */
00231                         /*              --Parag                         */
00232 #   endif
00233 # endif
00234 
00235 # ifdef VAX
00236 #   define MACH_TYPE "VAX"
00237 #   define ALIGNMENT 4  /* Pointers are longword aligned by 4.2 C compiler */
00238     extern char etext;
00239 #   define DATASTART ((ptr_t)(&etext))
00240 #   ifdef BSD
00241 #       define OS_TYPE "BSD"
00242 #       define HEURISTIC1
00243                         /* HEURISTIC2 may be OK, but it's hard to test. */
00244 #   endif
00245 #   ifdef ULTRIX
00246 #       define OS_TYPE "ULTRIX"
00247 #       define STACKBOTTOM ((ptr_t) 0x7fffc800)
00248 #   endif
00249 # endif
00250 
00251 # ifdef RT
00252 #   define MACH_TYPE "RT"
00253 #   define ALIGNMENT 4
00254 #   define DATASTART ((ptr_t) 0x10000000)
00255 #   define STACKBOTTOM ((ptr_t) 0x1fffd800)
00256 # endif
00257 
00258 # ifdef SPARC
00259 #   define MACH_TYPE "SPARC"
00260 #   define ALIGNMENT 4  /* Required by hardware */
00261     extern int etext;
00262 #   ifdef SUNOS5
00263 #       define OS_TYPE "SUNOS5"
00264 #       define DATASTART ((ptr_t)((((word) (&etext)) + 0x10003) & ~0x3))
00265                 /* Experimentally determined.                   */
00266                 /* Inconsistent with man a.out, which appears   */
00267                 /* to be wrong.                                 */
00268 #   endif
00269 #   ifdef SUNOS4
00270 #       define OS_TYPE "SUNOS4"
00271 #       define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
00272                 /* On very old SPARCs this is too conservative. */
00273 #   endif
00274 #   define HEURISTIC1
00275 # endif
00276 
00277 # ifdef I386
00278 #   define MACH_TYPE "I386"
00279 #   define ALIGNMENT 4  /* 32-bit compilers align pointers */
00280 #   ifdef SEQUENT
00281 #       define OS_TYPE "SEQUENT"
00282         extern int etext;
00283 #       define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
00284 #       define STACKBOTTOM ((ptr_t) 0x3ffff000) 
00285 #   endif
00286 #   ifdef SUNOS5
00287 #       define OS_TYPE "SUNOS5"
00288         extern int etext;
00289 #       define DATASTART ((ptr_t)((((word) (&etext)) + 0x1003) & ~0x3))
00290         extern int _start();
00291 #       define STACKBOTTOM ((ptr_t)(&_start))
00292 #   endif
00293 #   ifdef SCO
00294 #       define OS_TYPE "SCO"
00295 #       define DATASTART ((ptr_t)((((word) (&etext)) + 0x3fffff) \
00296                                   & ~0x3fffff) \
00297                                  +((word)&etext & 0xfff))
00298 #       define STACKBOTTOM ((ptr_t) 0x7ffffffc)
00299 #   endif
00300 #   ifdef LINUX
00301 #       define OS_TYPE "LINUX"
00302         extern int etext;
00303 #       define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
00304 #       define STACKBOTTOM ((ptr_t)0xc0000000)
00305 #   endif
00306 #   ifdef OS2
00307 #       define OS_TYPE "OS2"
00308 #       define DATASTART ((ptr_t)((((word) (&etext)) + 0x3fffff) \
00309                                   & ~0x3fffff) \
00310                                  +((word)&etext & 0xfff))
00311                 /* STACKBOTTOM is handled specially in GC_init_inner.   */
00312                 /* OS2 actually has the right system call!              */
00313 #   endif
00314 # endif
00315 
00316 # ifdef NS32K
00317 #   define MACH_TYPE "NS32K"
00318 #   define ALIGNMENT 4
00319     extern char **environ;
00320 #   define DATASTART ((ptr_t)(&environ))
00321                               /* hideous kludge: environ is the first   */
00322                               /* word in crt0.o, and delimits the start */
00323                               /* of the data segment, no matter which   */
00324                               /* ld options were passed through.        */
00325 #   define STACKBOTTOM ((ptr_t) 0xfffff000) /* for Encore */
00326 # endif
00327 
00328 # ifdef MIPS
00329 #   define MACH_TYPE "MIPS"
00330 #   define ALIGNMENT 4  /* Required by hardware */
00331 #   define DATASTART 0x10000000
00332                               /* Could probably be slightly higher since */
00333                               /* startup code allocates lots of junk     */
00334 #   define HEURISTIC2
00335 # endif
00336 
00337 # ifdef RS6000
00338 #   define MACH_TYPE "RS6000"
00339 #   define ALIGNMENT 4
00340 #   define DATASTART ((ptr_t)0x20000000)
00341 #   define STACKBOTTOM ((ptr_t)0x2ff80000)
00342 # endif
00343 
00344 # ifdef HP_PA
00345 #   define MACH_TYPE "HP_PA"
00346 #   define ALIGNMENT 4
00347     extern int __data_start;
00348 #   define DATASTART ((ptr_t)(&__data_start))
00349 #   define HEURISTIC2
00350 #   define STACK_GROWS_UP
00351 # endif
00352 
00353 # ifndef STACK_GROWS_UP
00354 #   define STACK_GROWS_DOWN
00355 # endif
00356 
00357 # ifndef CPP_WORDSZ
00358 #   define CPP_WORDSZ 32
00359 # endif
00360 
00361 # ifndef OS_TYPE
00362 #   define OS_TYPE ""
00363 # endif
00364 
00365 # if CPP_WORDSZ != 32 && CPP_WORDSZ != 64
00366    -> bad word size
00367 # endif
00368 
00369 # ifdef PCR
00370 #   undef STACKBOTTOM
00371 #   undef HEURISTIC1
00372 #   undef HEURISTIC2
00373 # endif
00374 
00375 # endif

Generated on Fri Jan 25 10:39:45 2008 for russell by  doxygen 1.5.4