Annotation of OpenXM_contrib/gc/gcconfig.h, Revision 1.1
1.1 ! maekawa 1: /*
! 2: * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
! 3: * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
! 4: * Copyright (c) 1996 by Silicon Graphics. All rights reserved.
! 5: *
! 6: * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
! 7: * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
! 8: *
! 9: * Permission is hereby granted to use or copy this program
! 10: * for any purpose, provided the above notices are retained on all copies.
! 11: * Permission to modify the code and to distribute modified code is granted,
! 12: * provided the above notices are retained, and a notice that the code was
! 13: * modified is included with the above copyright notice.
! 14: */
! 15:
! 16: #ifndef CONFIG_H
! 17:
! 18: # define CONFIG_H
! 19:
! 20: /* Machine dependent parameters. Some tuning parameters can be found */
! 21: /* near the top of gc_private.h. */
! 22:
! 23: /* Machine specific parts contributed by various people. See README file. */
! 24:
! 25: /* First a unified test for Linux: */
! 26: # if defined(linux) || defined(__linux__)
! 27: # define LINUX
! 28: # endif
! 29:
! 30: /* Determine the machine type: */
! 31: # if defined(sun) && defined(mc68000)
! 32: # define M68K
! 33: # define SUNOS4
! 34: # define mach_type_known
! 35: # endif
! 36: # if defined(hp9000s300)
! 37: # define M68K
! 38: # define HP
! 39: # define mach_type_known
! 40: # endif
! 41: # if defined(__OpenBSD__) && defined(m68k)
! 42: # define M68K
! 43: # define OPENBSD
! 44: # define mach_type_known
! 45: # endif
! 46: # if defined(__NetBSD__) && defined(m68k)
! 47: # define M68K
! 48: # define NETBSD
! 49: # define mach_type_known
! 50: # endif
! 51: # if defined(vax)
! 52: # define VAX
! 53: # ifdef ultrix
! 54: # define ULTRIX
! 55: # else
! 56: # define BSD
! 57: # endif
! 58: # define mach_type_known
! 59: # endif
! 60: # if defined(mips) || defined(__mips)
! 61: # define MIPS
! 62: # if defined(ultrix) || defined(__ultrix) || defined(__NetBSD__)
! 63: # define ULTRIX
! 64: # else
! 65: # if defined(_SYSTYPE_SVR4) || defined(SYSTYPE_SVR4) || defined(__SYSTYPE_SVR4__)
! 66: # define IRIX5 /* or IRIX 6.X */
! 67: # else
! 68: # define RISCOS /* or IRIX 4.X */
! 69: # endif
! 70: # endif
! 71: # define mach_type_known
! 72: # endif
! 73: # if defined(sequent) && defined(i386)
! 74: # define I386
! 75: # define SEQUENT
! 76: # define mach_type_known
! 77: # endif
! 78: # if defined(sun) && defined(i386)
! 79: # define I386
! 80: # define SUNOS5
! 81: # define mach_type_known
! 82: # endif
! 83: # if (defined(__OS2__) || defined(__EMX__)) && defined(__32BIT__)
! 84: # define I386
! 85: # define OS2
! 86: # define mach_type_known
! 87: # endif
! 88: # if defined(ibm032)
! 89: # define RT
! 90: # define mach_type_known
! 91: # endif
! 92: # if defined(sun) && (defined(sparc) || defined(__sparc))
! 93: # define SPARC
! 94: /* Test for SunOS 5.x */
! 95: # include <errno.h>
! 96: # ifdef ECHRNG
! 97: # define SUNOS5
! 98: # else
! 99: # define SUNOS4
! 100: # endif
! 101: # define mach_type_known
! 102: # endif
! 103: # if defined(sparc) && defined(unix) && !defined(sun) && !defined(linux)
! 104: # define SPARC
! 105: # define DRSNX
! 106: # define mach_type_known
! 107: # endif
! 108: # if defined(_IBMR2)
! 109: # define RS6000
! 110: # define mach_type_known
! 111: # endif
! 112: # if defined(_M_XENIX) && defined(_M_SYSV) && defined(_M_I386)
! 113: /* The above test may need refinement */
! 114: # define I386
! 115: # if defined(_SCO_ELF)
! 116: # define SCO_ELF
! 117: # else
! 118: # define SCO
! 119: # endif
! 120: # define mach_type_known
! 121: # endif
! 122: # if defined(_AUX_SOURCE)
! 123: # define M68K
! 124: # define SYSV
! 125: # define mach_type_known
! 126: # endif
! 127: # if defined(_PA_RISC1_0) || defined(_PA_RISC1_1) \
! 128: || defined(hppa) || defined(__hppa__)
! 129: # define HP_PA
! 130: # define mach_type_known
! 131: # endif
! 132: # if defined(LINUX) && defined(i386)
! 133: # define I386
! 134: # define mach_type_known
! 135: # endif
! 136: # if defined(LINUX) && defined(powerpc)
! 137: # define POWERPC
! 138: # define mach_type_known
! 139: # endif
! 140: # if defined(LINUX) && defined(__mc68000__)
! 141: # define M68K
! 142: # define mach_type_known
! 143: # endif
! 144: # if defined(linux) && defined(sparc)
! 145: # define SPARC
! 146: # define LINUX
! 147: # define mach_type_known
! 148: # endif
! 149: # if defined(__alpha) || defined(__alpha__)
! 150: # define ALPHA
! 151: # if !defined(LINUX)
! 152: # define OSF1 /* a.k.a Digital Unix */
! 153: # endif
! 154: # define mach_type_known
! 155: # endif
! 156: # if defined(_AMIGA)
! 157: # define M68K
! 158: # define AMIGA
! 159: # define mach_type_known
! 160: # endif
! 161: # if defined(THINK_C) || defined(__MWERKS__) && !defined(__powerc)
! 162: # define M68K
! 163: # define MACOS
! 164: # define mach_type_known
! 165: # endif
! 166: # if defined(__MWERKS__) && defined(__powerc)
! 167: # define POWERPC
! 168: # define MACOS
! 169: # define mach_type_known
! 170: # endif
! 171: # if defined(NeXT) && defined(mc68000)
! 172: # define M68K
! 173: # define NEXT
! 174: # define mach_type_known
! 175: # endif
! 176: # if defined(NeXT) && defined(i386)
! 177: # define I386
! 178: # define NEXT
! 179: # define mach_type_known
! 180: # endif
! 181: # if defined(__OpenBSD__) && defined(i386)
! 182: # define I386
! 183: # define OPENBSD
! 184: # define mach_type_known
! 185: # endif
! 186: # if defined(__FreeBSD__) && defined(i386)
! 187: # define I386
! 188: # define FREEBSD
! 189: # define mach_type_known
! 190: # endif
! 191: # if defined(__NetBSD__) && defined(i386)
! 192: # define I386
! 193: # define NETBSD
! 194: # define mach_type_known
! 195: # endif
! 196: # if defined(bsdi) && defined(i386)
! 197: # define I386
! 198: # define BSDI
! 199: # define mach_type_known
! 200: # endif
! 201: # if !defined(mach_type_known) && defined(__386BSD__)
! 202: # define I386
! 203: # define THREE86BSD
! 204: # define mach_type_known
! 205: # endif
! 206: # if defined(_CX_UX) && defined(_M88K)
! 207: # define M88K
! 208: # define CX_UX
! 209: # define mach_type_known
! 210: # endif
! 211: # if defined(DGUX)
! 212: # define M88K
! 213: /* DGUX defined */
! 214: # define mach_type_known
! 215: # endif
! 216: # if (defined(_MSDOS) || defined(_MSC_VER)) && (_M_IX86 >= 300) \
! 217: || defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__)
! 218: # define I386
! 219: # define MSWIN32 /* or Win32s */
! 220: # define mach_type_known
! 221: # endif
! 222: # if defined(__DJGPP__)
! 223: # define I386
! 224: # ifndef DJGPP
! 225: # define DJGPP /* MSDOS running the DJGPP port of GCC */
! 226: # endif
! 227: # define mach_type_known
! 228: # endif
! 229: # if defined(__CYGWIN32__) || defined(__CYGWIN__)
! 230: # define I386
! 231: # define CYGWIN32
! 232: # define mach_type_known
! 233: # endif
! 234: # if defined(__BORLANDC__)
! 235: # define I386
! 236: # define MSWIN32
! 237: # define mach_type_known
! 238: # endif
! 239: # if defined(_UTS) && !defined(mach_type_known)
! 240: # define S370
! 241: # define UTS4
! 242: # define mach_type_known
! 243: # endif
! 244: /* Ivan Demakov */
! 245: # if defined(__WATCOMC__) && defined(__386__)
! 246: # define I386
! 247: # if !defined(OS2) && !defined(MSWIN32) && !defined(DOS4GW)
! 248: # if defined(__OS2__)
! 249: # define OS2
! 250: # else
! 251: # if defined(__WINDOWS_386__) || defined(__NT__)
! 252: # define MSWIN32
! 253: # else
! 254: # define DOS4GW
! 255: # endif
! 256: # endif
! 257: # endif
! 258: # define mach_type_known
! 259: # endif
! 260:
! 261: /* Feel free to add more clauses here */
! 262:
! 263: /* Or manually define the machine type here. A machine type is */
! 264: /* characterized by the architecture. Some */
! 265: /* machine types are further subdivided by OS. */
! 266: /* the macros ULTRIX, RISCOS, and BSD to distinguish. */
! 267: /* Note that SGI IRIX is treated identically to RISCOS. */
! 268: /* SYSV on an M68K actually means A/UX. */
! 269: /* The distinction in these cases is usually the stack starting address */
! 270: # ifndef mach_type_known
! 271: --> unknown machine type
! 272: # endif
! 273: /* Mapping is: M68K ==> Motorola 680X0 */
! 274: /* (SUNOS4,HP,NEXT, and SYSV (A/UX), */
! 275: /* MACOS and AMIGA variants) */
! 276: /* I386 ==> Intel 386 */
! 277: /* (SEQUENT, OS2, SCO, LINUX, NETBSD, */
! 278: /* FREEBSD, THREE86BSD, MSWIN32, */
! 279: /* BSDI,SUNOS5, NEXT, other variants) */
! 280: /* NS32K ==> Encore Multimax */
! 281: /* MIPS ==> R2000 or R3000 */
! 282: /* (RISCOS, ULTRIX variants) */
! 283: /* VAX ==> DEC VAX */
! 284: /* (BSD, ULTRIX variants) */
! 285: /* RS6000 ==> IBM RS/6000 AIX3.X */
! 286: /* RT ==> IBM PC/RT */
! 287: /* HP_PA ==> HP9000/700 & /800 */
! 288: /* HP/UX */
! 289: /* SPARC ==> SPARC under SunOS */
! 290: /* (SUNOS4, SUNOS5, */
! 291: /* DRSNX variants) */
! 292: /* ALPHA ==> DEC Alpha */
! 293: /* (OSF1 and LINUX variants) */
! 294: /* M88K ==> Motorola 88XX0 */
! 295: /* (CX_UX and DGUX) */
! 296: /* S370 ==> 370-like machine */
! 297: /* running Amdahl UTS4 */
! 298:
! 299:
! 300: /*
! 301: * For each architecture and OS, the following need to be defined:
! 302: *
! 303: * CPP_WORD_SZ is a simple integer constant representing the word size.
! 304: * in bits. We assume byte addressibility, where a byte has 8 bits.
! 305: * We also assume CPP_WORD_SZ is either 32 or 64.
! 306: * (We care about the length of pointers, not hardware
! 307: * bus widths. Thus a 64 bit processor with a C compiler that uses
! 308: * 32 bit pointers should use CPP_WORD_SZ of 32, not 64. Default is 32.)
! 309: *
! 310: * MACH_TYPE is a string representation of the machine type.
! 311: * OS_TYPE is analogous for the OS.
! 312: *
! 313: * ALIGNMENT is the largest N, such that
! 314: * all pointer are guaranteed to be aligned on N byte boundaries.
! 315: * defining it to be 1 will always work, but perform poorly.
! 316: *
! 317: * DATASTART is the beginning of the data segment.
! 318: * On UNIX systems, the collector will scan the area between DATASTART
! 319: * and DATAEND for root pointers.
! 320: *
! 321: * DATAEND, if not &end.
! 322: *
! 323: * ALIGN_DOUBLE of GC_malloc should return blocks aligned to twice
! 324: * the pointer size.
! 325: *
! 326: * STACKBOTTOM is the cool end of the stack, which is usually the
! 327: * highest address in the stack.
! 328: * Under PCR or OS/2, we have other ways of finding thread stacks.
! 329: * For each machine, the following should:
! 330: * 1) define STACK_GROWS_UP if the stack grows toward higher addresses, and
! 331: * 2) define exactly one of
! 332: * STACKBOTTOM (should be defined to be an expression)
! 333: * HEURISTIC1
! 334: * HEURISTIC2
! 335: * If either of the last two macros are defined, then STACKBOTTOM is computed
! 336: * during collector startup using one of the following two heuristics:
! 337: * HEURISTIC1: Take an address inside GC_init's frame, and round it up to
! 338: * the next multiple of STACK_GRAN.
! 339: * HEURISTIC2: Take an address inside GC_init's frame, increment it repeatedly
! 340: * in small steps (decrement if STACK_GROWS_UP), and read the value
! 341: * at each location. Remember the value when the first
! 342: * Segmentation violation or Bus error is signalled. Round that
! 343: * to the nearest plausible page boundary, and use that instead
! 344: * of STACKBOTTOM.
! 345: *
! 346: * If no expression for STACKBOTTOM can be found, and neither of the above
! 347: * heuristics are usable, the collector can still be used with all of the above
! 348: * undefined, provided one of the following is done:
! 349: * 1) GC_mark_roots can be changed to somehow mark from the correct stack(s)
! 350: * without reference to STACKBOTTOM. This is appropriate for use in
! 351: * conjunction with thread packages, since there will be multiple stacks.
! 352: * (Allocating thread stacks in the heap, and treating them as ordinary
! 353: * heap data objects is also possible as a last resort. However, this is
! 354: * likely to introduce significant amounts of excess storage retention
! 355: * unless the dead parts of the thread stacks are periodically cleared.)
! 356: * 2) Client code may set GC_stackbottom before calling any GC_ routines.
! 357: * If the author of the client code controls the main program, this is
! 358: * easily accomplished by introducing a new main program, setting
! 359: * GC_stackbottom to the address of a local variable, and then calling
! 360: * the original main program. The new main program would read something
! 361: * like:
! 362: *
! 363: * # include "gc_private.h"
! 364: *
! 365: * main(argc, argv, envp)
! 366: * int argc;
! 367: * char **argv, **envp;
! 368: * {
! 369: * int dummy;
! 370: *
! 371: * GC_stackbottom = (ptr_t)(&dummy);
! 372: * return(real_main(argc, argv, envp));
! 373: * }
! 374: *
! 375: *
! 376: * Each architecture may also define the style of virtual dirty bit
! 377: * implementation to be used:
! 378: * MPROTECT_VDB: Write protect the heap and catch faults.
! 379: * PROC_VDB: Use the SVR4 /proc primitives to read dirty bits.
! 380: *
! 381: * An architecture may define DYNAMIC_LOADING if dynamic_load.c
! 382: * defined GC_register_dynamic_libraries() for the architecture.
! 383: */
! 384:
! 385:
! 386: # define STACK_GRAN 0x1000000
! 387: # ifdef M68K
! 388: # define MACH_TYPE "M68K"
! 389: # define ALIGNMENT 2
! 390: # ifdef OPENBSD
! 391: # define OS_TYPE "OPENBSD"
! 392: # define HEURISTIC2
! 393: extern char etext;
! 394: # define DATASTART ((ptr_t)(&etext))
! 395: # endif
! 396: # ifdef NETBSD
! 397: # define OS_TYPE "NETBSD"
! 398: # define HEURISTIC2
! 399: extern char etext;
! 400: # define DATASTART ((ptr_t)(&etext))
! 401: # endif
! 402: # ifdef LINUX
! 403: # define OS_TYPE "LINUX"
! 404: # define STACKBOTTOM ((ptr_t)0xf0000000)
! 405: # define MPROTECT_VDB
! 406: # ifdef __ELF__
! 407: # define DYNAMIC_LOADING
! 408: extern char **__environ;
! 409: # define DATASTART ((ptr_t)(&__environ))
! 410: /* hideous kludge: __environ is the first */
! 411: /* word in crt0.o, and delimits the start */
! 412: /* of the data segment, no matter which */
! 413: /* ld options were passed through. */
! 414: /* We could use _etext instead, but that */
! 415: /* would include .rodata, which may */
! 416: /* contain large read-only data tables */
! 417: /* that we'd rather not scan. */
! 418: extern int _end;
! 419: # define DATAEND (&_end)
! 420: # else
! 421: extern int etext;
! 422: # define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
! 423: # endif
! 424: # endif
! 425: # ifdef SUNOS4
! 426: # define OS_TYPE "SUNOS4"
! 427: extern char etext;
! 428: # define DATASTART ((ptr_t)((((word) (&etext)) + 0x1ffff) & ~0x1ffff))
! 429: # define HEURISTIC1 /* differs */
! 430: # define DYNAMIC_LOADING
! 431: # endif
! 432: # ifdef HP
! 433: # define OS_TYPE "HP"
! 434: extern char etext;
! 435: # define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
! 436: # define STACKBOTTOM ((ptr_t) 0xffeffffc)
! 437: /* empirically determined. seems to work. */
! 438: # include <unistd.h>
! 439: # define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
! 440: # endif
! 441: # ifdef SYSV
! 442: # define OS_TYPE "SYSV"
! 443: extern etext;
! 444: # define DATASTART ((ptr_t)((((word) (&etext)) + 0x3fffff) \
! 445: & ~0x3fffff) \
! 446: +((word)&etext & 0x1fff))
! 447: /* This only works for shared-text binaries with magic number 0413.
! 448: The other sorts of SysV binaries put the data at the end of the text,
! 449: in which case the default of &etext would work. Unfortunately,
! 450: handling both would require having the magic-number available.
! 451: -- Parag
! 452: */
! 453: # define STACKBOTTOM ((ptr_t)0xFFFFFFFE)
! 454: /* The stack starts at the top of memory, but */
! 455: /* 0x0 cannot be used as setjump_test complains */
! 456: /* that the stack direction is incorrect. Two */
! 457: /* bytes down from 0x0 should be safe enough. */
! 458: /* --Parag */
! 459: # include <sys/mmu.h>
! 460: # define GETPAGESIZE() PAGESIZE /* Is this still right? */
! 461: # endif
! 462: # ifdef AMIGA
! 463: # define OS_TYPE "AMIGA"
! 464: /* STACKBOTTOM and DATASTART handled specially */
! 465: /* in os_dep.c */
! 466: # define DATAEND /* not needed */
! 467: # define GETPAGESIZE() 4096
! 468: # endif
! 469: # ifdef MACOS
! 470: # ifndef __LOWMEM__
! 471: # include <LowMem.h>
! 472: # endif
! 473: # define OS_TYPE "MACOS"
! 474: /* see os_dep.c for details of global data segments. */
! 475: # define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
! 476: # define DATAEND /* not needed */
! 477: # define GETPAGESIZE() 4096
! 478: # endif
! 479: # ifdef NEXT
! 480: # define OS_TYPE "NEXT"
! 481: # define DATASTART ((ptr_t) get_etext())
! 482: # define STACKBOTTOM ((ptr_t) 0x4000000)
! 483: # define DATAEND /* not needed */
! 484: # endif
! 485: # endif
! 486:
! 487: # ifdef POWERPC
! 488: # define MACH_TYPE "POWERPC"
! 489: # define ALIGNMENT 2
! 490: # ifdef MACOS
! 491: # ifndef __LOWMEM__
! 492: # include <LowMem.h>
! 493: # endif
! 494: # define OS_TYPE "MACOS"
! 495: /* see os_dep.c for details of global data segments. */
! 496: # define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
! 497: # define DATAEND /* not needed */
! 498: # endif
! 499: # ifdef LINUX
! 500: # define OS_TYPE "LINUX"
! 501: # define HEURISTIC1
! 502: # undef STACK_GRAN
! 503: # define STACK_GRAN 0x10000000
! 504: # define DATASTART GC_data_start
! 505: extern int _end;
! 506: # define DATAEND (&_end)
! 507: # endif
! 508: # endif
! 509:
! 510: # ifdef VAX
! 511: # define MACH_TYPE "VAX"
! 512: # define ALIGNMENT 4 /* Pointers are longword aligned by 4.2 C compiler */
! 513: extern char etext;
! 514: # define DATASTART ((ptr_t)(&etext))
! 515: # ifdef BSD
! 516: # define OS_TYPE "BSD"
! 517: # define HEURISTIC1
! 518: /* HEURISTIC2 may be OK, but it's hard to test. */
! 519: # endif
! 520: # ifdef ULTRIX
! 521: # define OS_TYPE "ULTRIX"
! 522: # define STACKBOTTOM ((ptr_t) 0x7fffc800)
! 523: # endif
! 524: # endif
! 525:
! 526: # ifdef RT
! 527: # define MACH_TYPE "RT"
! 528: # define ALIGNMENT 4
! 529: # define DATASTART ((ptr_t) 0x10000000)
! 530: # define STACKBOTTOM ((ptr_t) 0x1fffd800)
! 531: # endif
! 532:
! 533: # ifdef SPARC
! 534: # define MACH_TYPE "SPARC"
! 535: # define ALIGNMENT 4 /* Required by hardware */
! 536: # define ALIGN_DOUBLE
! 537: extern int etext;
! 538: # ifdef SUNOS5
! 539: # define OS_TYPE "SUNOS5"
! 540: extern int _etext;
! 541: extern int _end;
! 542: extern char * GC_SysVGetDataStart();
! 543: # define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
! 544: # define DATAEND (&_end)
! 545: # ifndef USE_MMAP
! 546: # define USE_MMAP
! 547: # endif
! 548: # ifdef USE_MMAP
! 549: # define HEAP_START (ptr_t)0x40000000
! 550: # else
! 551: # define HEAP_START DATAEND
! 552: # endif
! 553: # define PROC_VDB
! 554: /* HEURISTIC1 reportedly no longer works under 2.7. Thus we */
! 555: /* switched to HEURISTIC2, eventhough it creates some debugging */
! 556: /* issues. */
! 557: # define HEURISTIC2
! 558: # include <unistd.h>
! 559: # define GETPAGESIZE() sysconf(_SC_PAGESIZE)
! 560: /* getpagesize() appeared to be missing from at least one */
! 561: /* Solaris 5.4 installation. Weird. */
! 562: # define DYNAMIC_LOADING
! 563: # endif
! 564: # ifdef SUNOS4
! 565: # define OS_TYPE "SUNOS4"
! 566: /* [If you have a weak stomach, don't read this.] */
! 567: /* We would like to use: */
! 568: /* # define DATASTART ((ptr_t)((((word) (&etext)) + 0x1fff) & ~0x1fff)) */
! 569: /* This fails occasionally, due to an ancient, but very */
! 570: /* persistent ld bug. &etext is set 32 bytes too high. */
! 571: /* We instead read the text segment size from the a.out */
! 572: /* header, which happens to be mapped into our address space */
! 573: /* at the start of the text segment. The detective work here */
! 574: /* was done by Robert Ehrlich, Manuel Serrano, and Bernard */
! 575: /* Serpette of INRIA. */
! 576: /* This assumes ZMAGIC, i.e. demand-loadable executables. */
! 577: # define TEXTSTART 0x2000
! 578: # define DATASTART ((ptr_t)(*(int *)(TEXTSTART+0x4)+TEXTSTART))
! 579: # define MPROTECT_VDB
! 580: # define HEURISTIC1
! 581: # define DYNAMIC_LOADING
! 582: # endif
! 583: # ifdef DRSNX
! 584: # define CPP_WORDSZ 32
! 585: # define OS_TYPE "DRSNX"
! 586: extern char * GC_SysVGetDataStart();
! 587: extern int etext;
! 588: # define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &etext)
! 589: # define MPROTECT_VDB
! 590: # define STACKBOTTOM ((ptr_t) 0xdfff0000)
! 591: # define DYNAMIC_LOADING
! 592: # endif
! 593: # ifdef LINUX
! 594: # define OS_TYPE "LINUX"
! 595: # ifdef __ELF__
! 596: # define DATASTART GC_data_start
! 597: # define DYNAMIC_LOADING
! 598: # else
! 599: Linux Sparc non elf ?
! 600: # endif
! 601: extern int _end;
! 602: # define DATAEND (&_end)
! 603: # define SVR4
! 604: # define STACKBOTTOM ((ptr_t) 0xf0000000)
! 605: # endif
! 606: # endif
! 607:
! 608: # ifdef I386
! 609: # define MACH_TYPE "I386"
! 610: # define ALIGNMENT 4 /* Appears to hold for all "32 bit" compilers */
! 611: /* except Borland. The -a4 option fixes */
! 612: /* Borland. */
! 613: /* Ivan Demakov: For Watcom the option is -zp4. */
! 614: # ifndef SMALL_CONFIG
! 615: # define ALIGN_DOUBLE /* Not strictly necessary, but may give speed */
! 616: /* improvement on Pentiums. */
! 617: # endif
! 618: # ifdef SEQUENT
! 619: # define OS_TYPE "SEQUENT"
! 620: extern int etext;
! 621: # define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
! 622: # define STACKBOTTOM ((ptr_t) 0x3ffff000)
! 623: # endif
! 624: # ifdef SUNOS5
! 625: # define OS_TYPE "SUNOS5"
! 626: extern int etext, _start;
! 627: extern char * GC_SysVGetDataStart();
! 628: # define DATASTART GC_SysVGetDataStart(0x1000, &etext)
! 629: # define STACKBOTTOM ((ptr_t)(&_start))
! 630: /** At least in Solaris 2.5, PROC_VDB gives wrong values for dirty bits. */
! 631: /*# define PROC_VDB*/
! 632: # define DYNAMIC_LOADING
! 633: # ifndef USE_MMAP
! 634: # define USE_MMAP
! 635: # endif
! 636: # ifdef USE_MMAP
! 637: # define HEAP_START (ptr_t)0x40000000
! 638: # else
! 639: # define HEAP_START DATAEND
! 640: # endif
! 641: # endif
! 642: # ifdef SCO
! 643: # define OS_TYPE "SCO"
! 644: extern int etext;
! 645: # define DATASTART ((ptr_t)((((word) (&etext)) + 0x3fffff) \
! 646: & ~0x3fffff) \
! 647: +((word)&etext & 0xfff))
! 648: # define STACKBOTTOM ((ptr_t) 0x7ffffffc)
! 649: # endif
! 650: # ifdef SCO_ELF
! 651: # define OS_TYPE "SCO_ELF"
! 652: extern int etext;
! 653: # define DATASTART ((ptr_t)(&etext))
! 654: # define STACKBOTTOM ((ptr_t) 0x08048000)
! 655: # define DYNAMIC_LOADING
! 656: # define ELF_CLASS ELFCLASS32
! 657: # endif
! 658: # ifdef LINUX
! 659: # define OS_TYPE "LINUX"
! 660: # define STACKBOTTOM ((ptr_t)0xc0000000)
! 661: /* Appears to be 0xe0000000 for at least one 2.1.91 kernel. */
! 662: /* Probably needs to be more flexible, but I don't yet */
! 663: /* fully understand how flexible. */
! 664: # if !defined(LINUX_THREADS) || !defined(REDIRECT_MALLOC)
! 665: # define MPROTECT_VDB
! 666: # else
! 667: /* We seem to get random errors in incremental mode, */
! 668: /* possibly because Linux threads is itself a malloc client */
! 669: /* and can't deal with the signals. */
! 670: # endif
! 671: # ifdef __ELF__
! 672: # define DYNAMIC_LOADING
! 673: # ifdef UNDEFINED /* includes ro data */
! 674: extern int _etext;
! 675: # define DATASTART ((ptr_t)((((word) (&_etext)) + 0xfff) & ~0xfff))
! 676: # endif
! 677: # include <features.h>
! 678: # if defined(__GLIBC__) && __GLIBC__ >= 2
! 679: extern int __data_start;
! 680: # define DATASTART ((ptr_t)(&__data_start))
! 681: # else
! 682: extern char **__environ;
! 683: # define DATASTART ((ptr_t)(&__environ))
! 684: /* hideous kludge: __environ is the first */
! 685: /* word in crt0.o, and delimits the start */
! 686: /* of the data segment, no matter which */
! 687: /* ld options were passed through. */
! 688: /* We could use _etext instead, but that */
! 689: /* would include .rodata, which may */
! 690: /* contain large read-only data tables */
! 691: /* that we'd rather not scan. */
! 692: # endif
! 693: extern int _end;
! 694: # define DATAEND (&_end)
! 695: # else
! 696: extern int etext;
! 697: # define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
! 698: # endif
! 699: # endif
! 700: # ifdef CYGWIN32
! 701: # define OS_TYPE "CYGWIN32"
! 702: extern int _data_start__;
! 703: extern int _data_end__;
! 704: extern int _bss_start__;
! 705: extern int _bss_end__;
! 706: /* For binutils 2.9.1, we have */
! 707: /* DATASTART = _data_start__ */
! 708: /* DATAEND = _bss_end__ */
! 709: /* whereas for some earlier versions it was */
! 710: /* DATASTART = _bss_start__ */
! 711: /* DATAEND = _data_end__ */
! 712: /* To get it right for both, we take the */
! 713: /* minumum/maximum of the two. */
! 714: # define MAX(x,y) ((x) > (y) ? (x) : (y))
! 715: # define MIN(x,y) ((x) < (y) ? (x) : (y))
! 716: # define DATASTART ((ptr_t) MIN(&_data_start__, &_bss_start__))
! 717: # define DATAEND ((ptr_t) MAX(&_data_end__, &_bss_end__))
! 718: # undef STACK_GRAN
! 719: # define STACK_GRAN 0x10000
! 720: # define HEURISTIC1
! 721: # endif
! 722: # ifdef OS2
! 723: # define OS_TYPE "OS2"
! 724: /* STACKBOTTOM and DATASTART are handled specially in */
! 725: /* os_dep.c. OS2 actually has the right */
! 726: /* system call! */
! 727: # define DATAEND /* not needed */
! 728: # endif
! 729: # ifdef MSWIN32
! 730: # define OS_TYPE "MSWIN32"
! 731: /* STACKBOTTOM and DATASTART are handled specially in */
! 732: /* os_dep.c. */
! 733: # ifndef __WATCOMC__
! 734: # define MPROTECT_VDB
! 735: # endif
! 736: # define DATAEND /* not needed */
! 737: # endif
! 738: # ifdef DJGPP
! 739: # define OS_TYPE "DJGPP"
! 740: # include "stubinfo.h"
! 741: extern int etext;
! 742: extern int _stklen;
! 743: extern int __djgpp_stack_limit;
! 744: # define DATASTART ((ptr_t)((((word) (&etext)) + 0x1ff) & ~0x1ff))
! 745: /* # define STACKBOTTOM ((ptr_t)((word) _stubinfo + _stubinfo->size \
! 746: + _stklen)) */
! 747: # define STACKBOTTOM ((ptr_t)((word) __djgpp_stack_limit + _stklen))
! 748: /* This may not be right. */
! 749: # endif
! 750: # ifdef OPENBSD
! 751: # define OS_TYPE "OPENBSD"
! 752: # endif
! 753: # ifdef FREEBSD
! 754: # define OS_TYPE "FREEBSD"
! 755: # define MPROTECT_VDB
! 756: # endif
! 757: # ifdef NETBSD
! 758: # define OS_TYPE "NETBSD"
! 759: # endif
! 760: # ifdef THREE86BSD
! 761: # define OS_TYPE "THREE86BSD"
! 762: # endif
! 763: # ifdef BSDI
! 764: # define OS_TYPE "BSDI"
! 765: # endif
! 766: # if defined(OPENBSD) || defined(FREEBSD) || defined(NETBSD) \
! 767: || defined(THREE86BSD) || defined(BSDI)
! 768: # define HEURISTIC2
! 769: extern char etext;
! 770: # define DATASTART ((ptr_t)(&etext))
! 771: # endif
! 772: # ifdef NEXT
! 773: # define OS_TYPE "NEXT"
! 774: # define DATASTART ((ptr_t) get_etext())
! 775: # define STACKBOTTOM ((ptr_t)0xc0000000)
! 776: # define DATAEND /* not needed */
! 777: # endif
! 778: # ifdef DOS4GW
! 779: # define OS_TYPE "DOS4GW"
! 780: extern long __nullarea;
! 781: extern char _end;
! 782: extern char *_STACKTOP;
! 783: /* Depending on calling conventions Watcom C either precedes
! 784: or does not precedes with undescore names of C-variables.
! 785: Make sure startup code variables always have the same names. */
! 786: #pragma aux __nullarea "*";
! 787: #pragma aux _end "*";
! 788: # define STACKBOTTOM ((ptr_t) _STACKTOP)
! 789: /* confused? me too. */
! 790: # define DATASTART ((ptr_t) &__nullarea)
! 791: # define DATAEND ((ptr_t) &_end)
! 792: # endif
! 793: # endif
! 794:
! 795: # ifdef NS32K
! 796: # define MACH_TYPE "NS32K"
! 797: # define ALIGNMENT 4
! 798: extern char **environ;
! 799: # define DATASTART ((ptr_t)(&environ))
! 800: /* hideous kludge: environ is the first */
! 801: /* word in crt0.o, and delimits the start */
! 802: /* of the data segment, no matter which */
! 803: /* ld options were passed through. */
! 804: # define STACKBOTTOM ((ptr_t) 0xfffff000) /* for Encore */
! 805: # endif
! 806:
! 807: # ifdef MIPS
! 808: # define MACH_TYPE "MIPS"
! 809: # ifndef IRIX5
! 810: # define DATASTART (ptr_t)0x10000000
! 811: /* Could probably be slightly higher since */
! 812: /* startup code allocates lots of stuff. */
! 813: # else
! 814: extern int _fdata;
! 815: # define DATASTART ((ptr_t)(&_fdata))
! 816: # ifdef USE_MMAP
! 817: # define HEAP_START (ptr_t)0x30000000
! 818: # else
! 819: # define HEAP_START DATASTART
! 820: # endif
! 821: /* Lowest plausible heap address. */
! 822: /* In the MMAP case, we map there. */
! 823: /* In either case it is used to identify */
! 824: /* heap sections so they're not */
! 825: /* considered as roots. */
! 826: # endif /* IRIX5 */
! 827: # define HEURISTIC2
! 828: /* # define STACKBOTTOM ((ptr_t)0x7fff8000) sometimes also works. */
! 829: # ifdef ULTRIX
! 830: # define OS_TYPE "ULTRIX"
! 831: # define ALIGNMENT 4
! 832: # endif
! 833: # ifdef RISCOS
! 834: # define OS_TYPE "RISCOS"
! 835: # define ALIGNMENT 4 /* Required by hardware */
! 836: # endif
! 837: # ifdef IRIX5
! 838: # define OS_TYPE "IRIX5"
! 839: # define MPROTECT_VDB
! 840: # ifdef _MIPS_SZPTR
! 841: # define CPP_WORDSZ _MIPS_SZPTR
! 842: # define ALIGNMENT (_MIPS_SZPTR/8)
! 843: # if CPP_WORDSZ != 64
! 844: # define ALIGN_DOUBLE
! 845: # endif
! 846: # else
! 847: # define ALIGNMENT 4
! 848: # define ALIGN_DOUBLE
! 849: # endif
! 850: # define DYNAMIC_LOADING
! 851: # endif
! 852: # endif
! 853:
! 854: # ifdef RS6000
! 855: # define MACH_TYPE "RS6000"
! 856: # define ALIGNMENT 4
! 857: # define DATASTART ((ptr_t)0x20000000)
! 858: extern int errno;
! 859: # define STACKBOTTOM ((ptr_t)((ulong)&errno))
! 860: # define DYNAMIC_LOADING
! 861: /* For really old versions of AIX, this may have to be removed. */
! 862: # endif
! 863:
! 864: # ifdef HP_PA
! 865: # define MACH_TYPE "HP_PA"
! 866: # define ALIGNMENT 4
! 867: # define ALIGN_DOUBLE
! 868: extern int __data_start;
! 869: # define DATASTART ((ptr_t)(&__data_start))
! 870: # if 0
! 871: /* The following appears to work for 7xx systems running HP/UX */
! 872: /* 9.xx Furthermore, it might result in much faster */
! 873: /* collections than HEURISTIC2, which may involve scanning */
! 874: /* segments that directly precede the stack. It is not the */
! 875: /* default, since it may not work on older machine/OS */
! 876: /* combinations. (Thanks to Raymond X.T. Nijssen for uncovering */
! 877: /* this.) */
! 878: # define STACKBOTTOM ((ptr_t) 0x7b033000) /* from /etc/conf/h/param.h */
! 879: # else
! 880: # define HEURISTIC2
! 881: # endif
! 882: # define STACK_GROWS_UP
! 883: # define DYNAMIC_LOADING
! 884: # include <unistd.h>
! 885: # define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
! 886: /* They misspelled the Posix macro? */
! 887: # endif
! 888:
! 889: # ifdef ALPHA
! 890: # define MACH_TYPE "ALPHA"
! 891: # define ALIGNMENT 8
! 892: # ifdef OSF1
! 893: # define OS_TYPE "OSF1"
! 894: # define DATASTART ((ptr_t) 0x140000000)
! 895: extern _end;
! 896: # define DATAEND ((ptr_t) &_end)
! 897: # define HEURISTIC2
! 898: /* Normally HEURISTIC2 is too conervative, since */
! 899: /* the text segment immediately follows the stack. */
! 900: /* Hence we give an upper pound. */
! 901: extern int __start;
! 902: # define HEURISTIC2_LIMIT ((ptr_t)((word)(&__start) & ~(getpagesize()-1)))
! 903: # define CPP_WORDSZ 64
! 904: # define MPROTECT_VDB
! 905: # define DYNAMIC_LOADING
! 906: # endif
! 907: # ifdef LINUX
! 908: # define OS_TYPE "LINUX"
! 909: # define CPP_WORDSZ 64
! 910: # define STACKBOTTOM ((ptr_t) 0x120000000)
! 911: # ifdef __ELF__
! 912: extern int __data_start;
! 913: # define DATASTART &__data_start
! 914: # define DYNAMIC_LOADING
! 915: # else
! 916: # define DATASTART ((ptr_t) 0x140000000)
! 917: # endif
! 918: extern int _end;
! 919: # define DATAEND (&_end)
! 920: # define MPROTECT_VDB
! 921: /* Has only been superficially tested. May not */
! 922: /* work on all versions. */
! 923: # endif
! 924: # endif
! 925:
! 926: # ifdef M88K
! 927: # define MACH_TYPE "M88K"
! 928: # define ALIGNMENT 4
! 929: # define ALIGN_DOUBLE
! 930: extern int etext;
! 931: # ifdef CX_UX
! 932: # define OS_TYPE "CX_UX"
! 933: # define DATASTART ((((word)&etext + 0x3fffff) & ~0x3fffff) + 0x10000)
! 934: # endif
! 935: # ifdef DGUX
! 936: # define OS_TYPE "DGUX"
! 937: extern char * GC_SysVGetDataStart();
! 938: # define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &etext)
! 939: # endif
! 940: # define STACKBOTTOM ((char*)0xf0000000) /* determined empirically */
! 941: # endif
! 942:
! 943: # ifdef S370
! 944: # define MACH_TYPE "S370"
! 945: # define OS_TYPE "UTS4"
! 946: # define ALIGNMENT 4 /* Required by hardware */
! 947: extern int etext;
! 948: extern int _etext;
! 949: extern int _end;
! 950: extern char * GC_SysVGetDataStart();
! 951: # define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
! 952: # define DATAEND (&_end)
! 953: # define HEURISTIC2
! 954: # endif
! 955:
! 956: # ifndef STACK_GROWS_UP
! 957: # define STACK_GROWS_DOWN
! 958: # endif
! 959:
! 960: # ifndef CPP_WORDSZ
! 961: # define CPP_WORDSZ 32
! 962: # endif
! 963:
! 964: # ifndef OS_TYPE
! 965: # define OS_TYPE ""
! 966: # endif
! 967:
! 968: # ifndef DATAEND
! 969: extern int end;
! 970: # define DATAEND (&end)
! 971: # endif
! 972:
! 973: # if defined(SVR4) && !defined(GETPAGESIZE)
! 974: # include <unistd.h>
! 975: # define GETPAGESIZE() sysconf(_SC_PAGESIZE)
! 976: # endif
! 977:
! 978: # ifndef GETPAGESIZE
! 979: # if defined(SUNOS5) || defined(IRIX5)
! 980: # include <unistd.h>
! 981: # endif
! 982: # define GETPAGESIZE() getpagesize()
! 983: # endif
! 984:
! 985: # if defined(SUNOS5) || defined(DRSNX) || defined(UTS4)
! 986: /* OS has SVR4 generic features. Probably others also qualify. */
! 987: # define SVR4
! 988: # endif
! 989:
! 990: # if defined(SUNOS5) || defined(DRSNX)
! 991: /* OS has SUNOS5 style semi-undocumented interface to dynamic */
! 992: /* loader. */
! 993: # define SUNOS5DL
! 994: /* OS has SUNOS5 style signal handlers. */
! 995: # define SUNOS5SIGS
! 996: # endif
! 997:
! 998: # if CPP_WORDSZ != 32 && CPP_WORDSZ != 64
! 999: -> bad word size
! 1000: # endif
! 1001:
! 1002: # ifdef PCR
! 1003: # undef DYNAMIC_LOADING
! 1004: # undef STACKBOTTOM
! 1005: # undef HEURISTIC1
! 1006: # undef HEURISTIC2
! 1007: # undef PROC_VDB
! 1008: # undef MPROTECT_VDB
! 1009: # define PCR_VDB
! 1010: # endif
! 1011:
! 1012: # ifdef SRC_M3
! 1013: /* Postponed for now. */
! 1014: # undef PROC_VDB
! 1015: # undef MPROTECT_VDB
! 1016: # endif
! 1017:
! 1018: # ifdef SMALL_CONFIG
! 1019: /* Presumably not worth the space it takes. */
! 1020: # undef PROC_VDB
! 1021: # undef MPROTECT_VDB
! 1022: # endif
! 1023:
! 1024: # if !defined(PCR_VDB) && !defined(PROC_VDB) && !defined(MPROTECT_VDB)
! 1025: # define DEFAULT_VDB
! 1026: # endif
! 1027:
! 1028: # if defined(_SOLARIS_PTHREADS) && !defined(SOLARIS_THREADS)
! 1029: # define SOLARIS_THREADS
! 1030: # endif
! 1031: # if defined(IRIX_THREADS) && !defined(IRIX5)
! 1032: --> inconsistent configuration
! 1033: # endif
! 1034: # if defined(IRIX_JDK_THREADS) && !defined(IRIX5)
! 1035: --> inconsistent configuration
! 1036: # endif
! 1037: # if defined(LINUX_THREADS) && !defined(LINUX)
! 1038: --> inconsistent configuration
! 1039: # endif
! 1040: # if defined(SOLARIS_THREADS) && !defined(SUNOS5)
! 1041: --> inconsistent configuration
! 1042: # endif
! 1043: # if defined(PCR) || defined(SRC_M3) || \
! 1044: defined(SOLARIS_THREADS) || defined(WIN32_THREADS) || \
! 1045: defined(IRIX_THREADS) || defined(LINUX_THREADS) || \
! 1046: defined(IRIX_JDK_THREADS)
! 1047: # define THREADS
! 1048: # endif
! 1049:
! 1050: # if defined(HP_PA) || defined(M88K) || defined(POWERPC) \
! 1051: || (defined(I386) && defined(OS2)) || defined(UTS4) || defined(LINT)
! 1052: /* Use setjmp based hack to mark from callee-save registers. */
! 1053: # define USE_GENERIC_PUSH_REGS
! 1054: # endif
! 1055: # if defined(SPARC) && !defined(LINUX)
! 1056: # define SAVE_CALL_CHAIN
! 1057: # define ASM_CLEAR_CODE /* Stack clearing is crucial, and we */
! 1058: /* include assembly code to do it well. */
! 1059: # endif
! 1060:
! 1061: # endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>