Annotation of OpenXM_contrib2/asir2000/gc/include/private/gcconfig.h, Revision 1.3
1.1 noro 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.
1.3 ! noro 5: * Copyright (c) 2000 by Hewlett-Packard Company. All rights reserved.
1.1 noro 6: *
7: * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
8: * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
9: *
10: * Permission is hereby granted to use or copy this program
11: * for any purpose, provided the above notices are retained on all copies.
12: * Permission to modify the code and to distribute modified code is granted,
13: * provided the above notices are retained, and a notice that the code was
14: * modified is included with the above copyright notice.
15: */
16:
1.3 ! noro 17: #ifndef GCCONFIG_H
1.1 noro 18:
1.3 ! noro 19: # define GCCONFIG_H
1.1 noro 20:
21: /* Machine dependent parameters. Some tuning parameters can be found */
22: /* near the top of gc_private.h. */
23:
24: /* Machine specific parts contributed by various people. See README file. */
25:
26: /* First a unified test for Linux: */
27: # if defined(linux) || defined(__linux__)
28: # define LINUX
29: # endif
30:
1.3 ! noro 31: /* And one for NetBSD: */
! 32: # if defined(__NetBSD__)
! 33: # define NETBSD
! 34: # endif
! 35:
1.1 noro 36: /* Determine the machine type: */
37: # if defined(sun) && defined(mc68000)
38: # define M68K
39: # define SUNOS4
40: # define mach_type_known
41: # endif
42: # if defined(hp9000s300)
43: # define M68K
44: # define HP
45: # define mach_type_known
46: # endif
47: # if defined(__OpenBSD__) && defined(m68k)
48: # define M68K
49: # define OPENBSD
50: # define mach_type_known
51: # endif
52: # if defined(__OpenBSD__) && defined(__sparc__)
53: # define SPARC
54: # define OPENBSD
55: # define mach_type_known
56: # endif
57: # if defined(__NetBSD__) && defined(m68k)
58: # define M68K
1.3 ! noro 59: # define mach_type_known
! 60: # endif
! 61: # if defined(__NetBSD__) && defined(__powerpc__)
! 62: # define POWERPC
! 63: # define mach_type_known
! 64: # endif
! 65: # if defined(__NetBSD__) && defined(__arm32__)
! 66: # define ARM32
1.1 noro 67: # define mach_type_known
68: # endif
69: # if defined(vax)
70: # define VAX
71: # ifdef ultrix
72: # define ULTRIX
73: # else
74: # define BSD
75: # endif
76: # define mach_type_known
77: # endif
78: # if defined(mips) || defined(__mips)
79: # define MIPS
1.3 ! noro 80: # if !defined(LINUX)
! 81: # if defined(ultrix) || defined(__ultrix) || defined(__NetBSD__)
! 82: # define ULTRIX
! 83: # else
! 84: # if defined(_SYSTYPE_SVR4) || defined(SYSTYPE_SVR4) \
! 85: || defined(__SYSTYPE_SVR4__)
! 86: # define IRIX5 /* or IRIX 6.X */
! 87: # else
! 88: # define RISCOS /* or IRIX 4.X */
! 89: # endif
! 90: # endif
! 91: # endif /* !LINUX */
! 92: # if defined(__NetBSD__) && defined(__MIPSEL__)
! 93: # undef ULTRIX
1.1 noro 94: # endif
95: # define mach_type_known
96: # endif
1.3 ! noro 97: # if defined(sequent) && (defined(i386) || defined(__i386__))
1.1 noro 98: # define I386
99: # define SEQUENT
100: # define mach_type_known
101: # endif
1.3 ! noro 102: # if defined(sun) && (defined(i386) || defined(__i386__))
1.1 noro 103: # define I386
104: # define SUNOS5
105: # define mach_type_known
106: # endif
107: # if (defined(__OS2__) || defined(__EMX__)) && defined(__32BIT__)
108: # define I386
109: # define OS2
110: # define mach_type_known
111: # endif
112: # if defined(ibm032)
113: # define RT
114: # define mach_type_known
115: # endif
116: # if defined(sun) && (defined(sparc) || defined(__sparc))
117: # define SPARC
118: /* Test for SunOS 5.x */
119: # include <errno.h>
120: # ifdef ECHRNG
121: # define SUNOS5
122: # else
123: # define SUNOS4
124: # endif
125: # define mach_type_known
126: # endif
127: # if defined(sparc) && defined(unix) && !defined(sun) && !defined(linux) \
1.3 ! noro 128: && !defined(__OpenBSD__) && !(__NetBSD__)
1.1 noro 129: # define SPARC
130: # define DRSNX
131: # define mach_type_known
132: # endif
133: # if defined(_IBMR2)
134: # define RS6000
135: # define mach_type_known
136: # endif
1.3 ! noro 137: # if defined(__NetBSD__) && defined(__sparc__)
! 138: # define SPARC
! 139: # define mach_type_known
! 140: # endif
1.1 noro 141: # if defined(_M_XENIX) && defined(_M_SYSV) && defined(_M_I386)
142: /* The above test may need refinement */
143: # define I386
144: # if defined(_SCO_ELF)
145: # define SCO_ELF
146: # else
147: # define SCO
148: # endif
149: # define mach_type_known
150: # endif
151: # if defined(_AUX_SOURCE)
152: # define M68K
153: # define SYSV
154: # define mach_type_known
155: # endif
1.3 ! noro 156: # if defined(_PA_RISC1_0) || defined(_PA_RISC1_1) || defined(_PA_RISC2_0) \
1.1 noro 157: || defined(hppa) || defined(__hppa__)
158: # define HP_PA
1.3 ! noro 159: # ifndef LINUX
! 160: # define HPUX
! 161: # endif
1.1 noro 162: # define mach_type_known
163: # endif
1.3 ! noro 164: # if defined(__BEOS__) && defined(_X86_)
! 165: # define I386
! 166: # define BEOS
! 167: # define mach_type_known
! 168: # endif
1.1 noro 169: # if defined(LINUX) && (defined(i386) || defined(__i386__))
170: # define I386
171: # define mach_type_known
172: # endif
1.3 ! noro 173: # if defined(LINUX) && (defined(__ia64__) || defined(__ia64))
! 174: # define IA64
! 175: # define mach_type_known
! 176: # endif
1.1 noro 177: # if defined(LINUX) && defined(powerpc)
178: # define POWERPC
179: # define mach_type_known
180: # endif
181: # if defined(LINUX) && defined(__mc68000__)
182: # define M68K
183: # define mach_type_known
184: # endif
1.3 ! noro 185: # if defined(LINUX) && (defined(sparc) || defined(__sparc__))
1.1 noro 186: # define SPARC
187: # define mach_type_known
188: # endif
1.3 ! noro 189: # if defined(LINUX) && defined(__arm__)
! 190: # define ARM32
! 191: # define mach_type_known
! 192: # endif
! 193: # if defined(LINUX) && defined(__sh__)
! 194: # define SH
! 195: # define mach_type_known
! 196: # endif
1.1 noro 197: # if defined(__alpha) || defined(__alpha__)
198: # define ALPHA
1.3 ! noro 199: # if !defined(LINUX) && !defined(NETBSD)
1.1 noro 200: # define OSF1 /* a.k.a Digital Unix */
201: # endif
202: # define mach_type_known
203: # endif
204: # if defined(_AMIGA) && !defined(AMIGA)
205: # define AMIGA
206: # endif
207: # ifdef AMIGA
208: # define M68K
209: # define mach_type_known
210: # endif
211: # if defined(THINK_C) || defined(__MWERKS__) && !defined(__powerc)
212: # define M68K
213: # define MACOS
214: # define mach_type_known
215: # endif
216: # if defined(__MWERKS__) && defined(__powerc)
217: # define POWERPC
218: # define MACOS
219: # define mach_type_known
220: # endif
1.3 ! noro 221: # if defined(macosx) || \
! 222: defined(__APPLE__) && defined(__MACH__) && defined(__ppc__)
1.1 noro 223: # define MACOSX
224: # define POWERPC
225: # define mach_type_known
226: # endif
1.3 ! noro 227: # if defined(__APPLE__) && defined(__MACH__) && defined(__i386__)
! 228: # define MACOSX
! 229: # define I386
! 230: --> Not really supported, but at least we recognize it.
! 231: # endif
1.1 noro 232: # if defined(NeXT) && defined(mc68000)
233: # define M68K
234: # define NEXT
235: # define mach_type_known
236: # endif
1.3 ! noro 237: # if defined(NeXT) && (defined(i386) || defined(__i386__))
1.1 noro 238: # define I386
239: # define NEXT
240: # define mach_type_known
241: # endif
1.3 ! noro 242: # if defined(__OpenBSD__) && (defined(i386) || defined(__i386__))
1.1 noro 243: # define I386
244: # define OPENBSD
245: # define mach_type_known
246: # endif
1.3 ! noro 247: # if defined(__FreeBSD__) && (defined(i386) || defined(__i386__))
1.1 noro 248: # define I386
249: # define FREEBSD
250: # define mach_type_known
251: # endif
1.3 ! noro 252: # if defined(__NetBSD__) && (defined(i386) || defined(__i386__))
1.1 noro 253: # define I386
254: # define mach_type_known
255: # endif
1.3 ! noro 256: # if defined(bsdi) && (defined(i386) || defined(__i386__))
1.1 noro 257: # define I386
258: # define BSDI
259: # define mach_type_known
260: # endif
261: # if !defined(mach_type_known) && defined(__386BSD__)
262: # define I386
263: # define THREE86BSD
264: # define mach_type_known
265: # endif
266: # if defined(_CX_UX) && defined(_M88K)
267: # define M88K
268: # define CX_UX
269: # define mach_type_known
270: # endif
271: # if defined(DGUX)
272: # define M88K
273: /* DGUX defined */
274: # define mach_type_known
275: # endif
1.3 ! noro 276: # if defined(_WIN32_WCE)
! 277: /* SH3, SH4, MIPS already defined for corresponding architectures */
! 278: # if defined(SH3) || defined(SH4)
! 279: # define SH
! 280: # endif
! 281: # if defined(x86)
! 282: # define I386
! 283: # endif
! 284: # if defined(ARM)
! 285: # define ARM32
! 286: # endif
! 287: # define MSWINCE
! 288: # define mach_type_known
! 289: # else
! 290: # if (defined(_MSDOS) || defined(_MSC_VER)) && (_M_IX86 >= 300) \
! 291: || defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__)
! 292: # define I386
! 293: # define MSWIN32 /* or Win32s */
! 294: # define mach_type_known
! 295: # endif
1.1 noro 296: # endif
297: # if defined(__DJGPP__)
298: # define I386
299: # ifndef DJGPP
300: # define DJGPP /* MSDOS running the DJGPP port of GCC */
301: # endif
302: # define mach_type_known
303: # endif
304: # if defined(__CYGWIN32__) || defined(__CYGWIN__)
305: # define I386
306: # define CYGWIN32
307: # define mach_type_known
308: # endif
1.3 ! noro 309: # if defined(__MINGW32__)
! 310: # define I386
! 311: # define MSWIN32
! 312: # define mach_type_known
! 313: # endif
1.1 noro 314: # if defined(__BORLANDC__)
315: # define I386
316: # define MSWIN32
317: # define mach_type_known
318: # endif
319: # if defined(_UTS) && !defined(mach_type_known)
320: # define S370
321: # define UTS4
322: # define mach_type_known
323: # endif
1.3 ! noro 324: # if defined(__pj__)
! 325: # define PJ
! 326: # define mach_type_known
! 327: # endif
! 328: # if defined(__embedded__) && defined(PPC)
! 329: # define POWERPC
! 330: # define NOSYS
! 331: # define mach_type_known
! 332: # endif
1.1 noro 333: /* Ivan Demakov */
334: # if defined(__WATCOMC__) && defined(__386__)
335: # define I386
336: # if !defined(OS2) && !defined(MSWIN32) && !defined(DOS4GW)
337: # if defined(__OS2__)
338: # define OS2
339: # else
340: # if defined(__WINDOWS_386__) || defined(__NT__)
341: # define MSWIN32
342: # else
343: # define DOS4GW
344: # endif
345: # endif
346: # endif
347: # define mach_type_known
348: # endif
1.3 ! noro 349: # if defined(__s390__) && defined(LINUX)
! 350: # define S370
! 351: # define mach_type_known
! 352: # endif
1.1 noro 353:
354: /* Feel free to add more clauses here */
355:
356: /* Or manually define the machine type here. A machine type is */
357: /* characterized by the architecture. Some */
358: /* machine types are further subdivided by OS. */
359: /* the macros ULTRIX, RISCOS, and BSD to distinguish. */
360: /* Note that SGI IRIX is treated identically to RISCOS. */
361: /* SYSV on an M68K actually means A/UX. */
362: /* The distinction in these cases is usually the stack starting address */
363: # ifndef mach_type_known
364: --> unknown machine type
365: # endif
366: /* Mapping is: M68K ==> Motorola 680X0 */
367: /* (SUNOS4,HP,NEXT, and SYSV (A/UX), */
368: /* MACOS and AMIGA variants) */
369: /* I386 ==> Intel 386 */
370: /* (SEQUENT, OS2, SCO, LINUX, NETBSD, */
371: /* FREEBSD, THREE86BSD, MSWIN32, */
372: /* BSDI,SUNOS5, NEXT, other variants) */
373: /* NS32K ==> Encore Multimax */
374: /* MIPS ==> R2000 or R3000 */
375: /* (RISCOS, ULTRIX variants) */
376: /* VAX ==> DEC VAX */
377: /* (BSD, ULTRIX variants) */
378: /* RS6000 ==> IBM RS/6000 AIX3.X */
379: /* RT ==> IBM PC/RT */
380: /* HP_PA ==> HP9000/700 & /800 */
1.3 ! noro 381: /* HP/UX, LINUX */
! 382: /* SPARC ==> SPARC v7/v8/v9 */
! 383: /* (SUNOS4, SUNOS5, LINUX, */
1.1 noro 384: /* DRSNX variants) */
385: /* ALPHA ==> DEC Alpha */
386: /* (OSF1 and LINUX variants) */
387: /* M88K ==> Motorola 88XX0 */
388: /* (CX_UX and DGUX) */
389: /* S370 ==> 370-like machine */
390: /* running Amdahl UTS4 */
1.3 ! noro 391: /* or a 390 running LINUX */
! 392: /* ARM32 ==> Intel StrongARM */
! 393: /* IA64 ==> Intel IA64 */
! 394: /* (e.g. Itanium) */
! 395: /* SH ==> Hitachi SuperH */
! 396: /* (LINUX & MSWINCE) */
1.1 noro 397:
398:
399: /*
400: * For each architecture and OS, the following need to be defined:
401: *
402: * CPP_WORD_SZ is a simple integer constant representing the word size.
403: * in bits. We assume byte addressibility, where a byte has 8 bits.
404: * We also assume CPP_WORD_SZ is either 32 or 64.
405: * (We care about the length of pointers, not hardware
406: * bus widths. Thus a 64 bit processor with a C compiler that uses
407: * 32 bit pointers should use CPP_WORD_SZ of 32, not 64. Default is 32.)
408: *
409: * MACH_TYPE is a string representation of the machine type.
410: * OS_TYPE is analogous for the OS.
411: *
412: * ALIGNMENT is the largest N, such that
413: * all pointer are guaranteed to be aligned on N byte boundaries.
414: * defining it to be 1 will always work, but perform poorly.
415: *
416: * DATASTART is the beginning of the data segment.
417: * On UNIX systems, the collector will scan the area between DATASTART
418: * and DATAEND for root pointers.
419: *
420: * DATAEND, if not &end.
421: *
422: * ALIGN_DOUBLE of GC_malloc should return blocks aligned to twice
423: * the pointer size.
424: *
425: * STACKBOTTOM is the cool end of the stack, which is usually the
426: * highest address in the stack.
427: * Under PCR or OS/2, we have other ways of finding thread stacks.
428: * For each machine, the following should:
429: * 1) define STACK_GROWS_UP if the stack grows toward higher addresses, and
430: * 2) define exactly one of
431: * STACKBOTTOM (should be defined to be an expression)
432: * HEURISTIC1
433: * HEURISTIC2
434: * If either of the last two macros are defined, then STACKBOTTOM is computed
435: * during collector startup using one of the following two heuristics:
436: * HEURISTIC1: Take an address inside GC_init's frame, and round it up to
437: * the next multiple of STACK_GRAN.
438: * HEURISTIC2: Take an address inside GC_init's frame, increment it repeatedly
439: * in small steps (decrement if STACK_GROWS_UP), and read the value
440: * at each location. Remember the value when the first
441: * Segmentation violation or Bus error is signalled. Round that
442: * to the nearest plausible page boundary, and use that instead
443: * of STACKBOTTOM.
444: *
1.3 ! noro 445: * Gustavo Rodriguez-Rivera points out that on most (all?) Unix machines,
! 446: * the value of environ is a pointer that can serve as STACKBOTTOM.
! 447: * I expect that HEURISTIC2 can be replaced by this approach, which
! 448: * interferes far less with debugging. However it has the disadvantage
! 449: * that it's confused by a putenv call before the collector is initialized.
! 450: * This could be dealt with by intercepting putenv ...
! 451: *
1.1 noro 452: * If no expression for STACKBOTTOM can be found, and neither of the above
453: * heuristics are usable, the collector can still be used with all of the above
454: * undefined, provided one of the following is done:
455: * 1) GC_mark_roots can be changed to somehow mark from the correct stack(s)
456: * without reference to STACKBOTTOM. This is appropriate for use in
457: * conjunction with thread packages, since there will be multiple stacks.
458: * (Allocating thread stacks in the heap, and treating them as ordinary
459: * heap data objects is also possible as a last resort. However, this is
460: * likely to introduce significant amounts of excess storage retention
461: * unless the dead parts of the thread stacks are periodically cleared.)
462: * 2) Client code may set GC_stackbottom before calling any GC_ routines.
463: * If the author of the client code controls the main program, this is
464: * easily accomplished by introducing a new main program, setting
465: * GC_stackbottom to the address of a local variable, and then calling
466: * the original main program. The new main program would read something
467: * like:
468: *
469: * # include "gc_private.h"
470: *
471: * main(argc, argv, envp)
472: * int argc;
473: * char **argv, **envp;
474: * {
475: * int dummy;
476: *
477: * GC_stackbottom = (ptr_t)(&dummy);
478: * return(real_main(argc, argv, envp));
479: * }
480: *
481: *
482: * Each architecture may also define the style of virtual dirty bit
483: * implementation to be used:
484: * MPROTECT_VDB: Write protect the heap and catch faults.
485: * PROC_VDB: Use the SVR4 /proc primitives to read dirty bits.
486: *
487: * An architecture may define DYNAMIC_LOADING if dynamic_load.c
488: * defined GC_register_dynamic_libraries() for the architecture.
1.3 ! noro 489: *
! 490: * An architecture may define PREFETCH(x) to preload the cache with *x.
! 491: * This defaults to a no-op.
! 492: *
! 493: * PREFETCH_FOR_WRITE(x) is used if *x is about to be written.
! 494: *
! 495: * An architecture may also define CLEAR_DOUBLE(x) to be a fast way to
! 496: * clear the two words at GC_malloc-aligned address x. By default,
! 497: * word stores of 0 are used instead.
1.1 noro 498: */
499:
500:
501: # define STACK_GRAN 0x1000000
502: # ifdef M68K
503: # define MACH_TYPE "M68K"
504: # define ALIGNMENT 2
505: # ifdef OPENBSD
506: # define OS_TYPE "OPENBSD"
507: # define HEURISTIC2
508: extern char etext;
509: # define DATASTART ((ptr_t)(&etext))
510: # endif
511: # ifdef NETBSD
512: # define OS_TYPE "NETBSD"
513: # define HEURISTIC2
514: extern char etext;
515: # define DATASTART ((ptr_t)(&etext))
516: # endif
517: # ifdef LINUX
518: # define OS_TYPE "LINUX"
519: # define STACKBOTTOM ((ptr_t)0xf0000000)
520: # define MPROTECT_VDB
521: # ifdef __ELF__
522: # define DYNAMIC_LOADING
1.3 ! noro 523: # include <features.h>
! 524: # if defined(__GLIBC__)&& __GLIBC__>=2
! 525: # define LINUX_DATA_START
! 526: # else /* !GLIBC2 */
! 527: extern char **__environ;
! 528: # define DATASTART ((ptr_t)(&__environ))
1.1 noro 529: /* hideous kludge: __environ is the first */
530: /* word in crt0.o, and delimits the start */
531: /* of the data segment, no matter which */
532: /* ld options were passed through. */
533: /* We could use _etext instead, but that */
534: /* would include .rodata, which may */
535: /* contain large read-only data tables */
536: /* that we'd rather not scan. */
1.3 ! noro 537: # endif /* !GLIBC2 */
1.1 noro 538: extern int _end;
539: # define DATAEND (&_end)
540: # else
541: extern int etext;
542: # define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
543: # endif
544: # endif
545: # ifdef SUNOS4
546: # define OS_TYPE "SUNOS4"
547: extern char etext;
548: # define DATASTART ((ptr_t)((((word) (&etext)) + 0x1ffff) & ~0x1ffff))
549: # define HEURISTIC1 /* differs */
550: # define DYNAMIC_LOADING
551: # endif
552: # ifdef HP
553: # define OS_TYPE "HP"
554: extern char etext;
555: # define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
556: # define STACKBOTTOM ((ptr_t) 0xffeffffc)
557: /* empirically determined. seems to work. */
558: # include <unistd.h>
559: # define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
560: # endif
561: # ifdef SYSV
562: # define OS_TYPE "SYSV"
563: extern etext;
564: # define DATASTART ((ptr_t)((((word) (&etext)) + 0x3fffff) \
565: & ~0x3fffff) \
566: +((word)&etext & 0x1fff))
567: /* This only works for shared-text binaries with magic number 0413.
568: The other sorts of SysV binaries put the data at the end of the text,
569: in which case the default of &etext would work. Unfortunately,
570: handling both would require having the magic-number available.
571: -- Parag
572: */
573: # define STACKBOTTOM ((ptr_t)0xFFFFFFFE)
574: /* The stack starts at the top of memory, but */
575: /* 0x0 cannot be used as setjump_test complains */
576: /* that the stack direction is incorrect. Two */
577: /* bytes down from 0x0 should be safe enough. */
578: /* --Parag */
579: # include <sys/mmu.h>
580: # define GETPAGESIZE() PAGESIZE /* Is this still right? */
581: # endif
582: # ifdef AMIGA
583: # define OS_TYPE "AMIGA"
584: /* STACKBOTTOM and DATASTART handled specially */
585: /* in os_dep.c */
586: # define DATAEND /* not needed */
587: # define GETPAGESIZE() 4096
588: # endif
589: # ifdef MACOS
590: # ifndef __LOWMEM__
591: # include <LowMem.h>
592: # endif
593: # define OS_TYPE "MACOS"
594: /* see os_dep.c for details of global data segments. */
595: # define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
596: # define DATAEND /* not needed */
597: # define GETPAGESIZE() 4096
598: # endif
599: # ifdef NEXT
600: # define OS_TYPE "NEXT"
601: # define DATASTART ((ptr_t) get_etext())
602: # define STACKBOTTOM ((ptr_t) 0x4000000)
603: # define DATAEND /* not needed */
604: # endif
605: # endif
606:
607: # ifdef POWERPC
608: # define MACH_TYPE "POWERPC"
609: # ifdef MACOS
610: # define ALIGNMENT 2 /* Still necessary? Could it be 4? */
611: # ifndef __LOWMEM__
612: # include <LowMem.h>
613: # endif
614: # define OS_TYPE "MACOS"
615: /* see os_dep.c for details of global data segments. */
616: # define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
617: # define DATAEND /* not needed */
618: # endif
619: # ifdef LINUX
620: # define ALIGNMENT 4 /* Guess. Can someone verify? */
621: /* This was 2, but that didn't sound right. */
622: # define OS_TYPE "LINUX"
623: # define HEURISTIC1
1.3 ! noro 624: # define DYNAMIC_LOADING
1.1 noro 625: # undef STACK_GRAN
626: # define STACK_GRAN 0x10000000
627: /* Stack usually starts at 0x80000000 */
1.3 ! noro 628: # define LINUX_DATA_START
1.1 noro 629: extern int _end;
630: # define DATAEND (&_end)
631: # endif
632: # ifdef MACOSX
1.3 ! noro 633: /* There are reasons to suspect this may not be reliable. */
1.1 noro 634: # define ALIGNMENT 4
635: # define OS_TYPE "MACOSX"
636: # define DATASTART ((ptr_t) get_etext())
637: # define STACKBOTTOM ((ptr_t) 0xc0000000)
638: # define DATAEND /* not needed */
1.3 ! noro 639: # define MPROTECT_VDB
! 640: # include <unistd.h>
! 641: # define GETPAGESIZE() getpagesize()
! 642: # endif
! 643: # ifdef NETBSD
! 644: # define ALIGNMENT 4
! 645: # define OS_TYPE "NETBSD"
! 646: # define HEURISTIC2
! 647: extern char etext;
! 648: # define DATASTART GC_data_start
! 649: # define DYNAMIC_LOADING
! 650: # endif
! 651: # ifdef NOSYS
! 652: # define ALIGNMENT 4
! 653: # define OS_TYPE "NOSYS"
! 654: extern void __end, __dso_handle;
! 655: # define DATASTART (&__dso_handle) /* OK, that's ugly. */
! 656: # define DATAEND (&__end)
! 657: /* Stack starts at 0xE0000000 for the simulator. */
! 658: # undef STACK_GRAN
! 659: # define STACK_GRAN 0x10000000
! 660: # define HEURISTIC1
1.1 noro 661: # endif
662: # endif
663:
664: # ifdef VAX
665: # define MACH_TYPE "VAX"
666: # define ALIGNMENT 4 /* Pointers are longword aligned by 4.2 C compiler */
667: extern char etext;
668: # define DATASTART ((ptr_t)(&etext))
669: # ifdef BSD
670: # define OS_TYPE "BSD"
671: # define HEURISTIC1
672: /* HEURISTIC2 may be OK, but it's hard to test. */
673: # endif
674: # ifdef ULTRIX
675: # define OS_TYPE "ULTRIX"
676: # define STACKBOTTOM ((ptr_t) 0x7fffc800)
677: # endif
678: # endif
679:
680: # ifdef RT
681: # define MACH_TYPE "RT"
682: # define ALIGNMENT 4
683: # define DATASTART ((ptr_t) 0x10000000)
684: # define STACKBOTTOM ((ptr_t) 0x1fffd800)
685: # endif
686:
687: # ifdef SPARC
688: # define MACH_TYPE "SPARC"
1.3 ! noro 689: # if defined(__arch64__) || defined(__sparcv9)
! 690: # define ALIGNMENT 8
! 691: # else
! 692: # define ALIGNMENT 4 /* Required by hardware */
! 693: # endif
1.1 noro 694: # define ALIGN_DOUBLE
695: # ifdef SUNOS5
696: # define OS_TYPE "SUNOS5"
697: extern int _etext;
698: extern int _end;
699: extern char * GC_SysVGetDataStart();
700: # define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
701: # define DATAEND (&_end)
702: # ifndef USE_MMAP
703: # define USE_MMAP
704: # endif
705: # ifdef USE_MMAP
706: # define HEAP_START (ptr_t)0x40000000
707: # else
708: # define HEAP_START DATAEND
709: # endif
710: # define PROC_VDB
1.3 ! noro 711: /* HEURISTIC1 reportedly no longer works under 2.7. */
! 712: /* HEURISTIC2 probably works, but this appears to be preferable. */
! 713: /* Apparently USRSTACK is defined to be USERLIMIT, but in some */
! 714: /* installations that's undefined. We work around this with a */
! 715: /* gross hack: */
! 716: # include <sys/vmparam.h>
! 717: # ifdef USERLIMIT
! 718: /* This should work everywhere, but doesn't. */
! 719: # define STACKBOTTOM USRSTACK
! 720: # else
! 721: # if MPI
! 722: extern int *StackBottom;
! 723: # define STACKBOTTOM (ptr_t)(StackBottom)
! 724: # else
! 725: # define HEURISTIC2
! 726: # endif
! 727: # endif
1.1 noro 728: # include <unistd.h>
729: # define GETPAGESIZE() sysconf(_SC_PAGESIZE)
730: /* getpagesize() appeared to be missing from at least one */
731: /* Solaris 5.4 installation. Weird. */
732: # define DYNAMIC_LOADING
733: # endif
734: # ifdef SUNOS4
735: # define OS_TYPE "SUNOS4"
736: /* [If you have a weak stomach, don't read this.] */
737: /* We would like to use: */
738: /* # define DATASTART ((ptr_t)((((word) (&etext)) + 0x1fff) & ~0x1fff)) */
739: /* This fails occasionally, due to an ancient, but very */
740: /* persistent ld bug. &etext is set 32 bytes too high. */
741: /* We instead read the text segment size from the a.out */
742: /* header, which happens to be mapped into our address space */
743: /* at the start of the text segment. The detective work here */
744: /* was done by Robert Ehrlich, Manuel Serrano, and Bernard */
745: /* Serpette of INRIA. */
746: /* This assumes ZMAGIC, i.e. demand-loadable executables. */
747: # define TEXTSTART 0x2000
748: # define DATASTART ((ptr_t)(*(int *)(TEXTSTART+0x4)+TEXTSTART))
749: # define MPROTECT_VDB
750: # define HEURISTIC1
751: # define DYNAMIC_LOADING
752: # endif
753: # ifdef DRSNX
754: # define CPP_WORDSZ 32
755: # define OS_TYPE "DRSNX"
756: extern char * GC_SysVGetDataStart();
757: extern int etext;
758: # define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &etext)
759: # define MPROTECT_VDB
760: # define STACKBOTTOM ((ptr_t) 0xdfff0000)
761: # define DYNAMIC_LOADING
762: # endif
763: # ifdef LINUX
764: # define OS_TYPE "LINUX"
765: # ifdef __ELF__
1.3 ! noro 766: # define DYNAMIC_LOADING
1.1 noro 767: # else
1.3 ! noro 768: Linux Sparc/a.out not supported
1.1 noro 769: # endif
770: extern int _end;
1.3 ! noro 771: extern int _etext;
1.1 noro 772: # define DATAEND (&_end)
773: # define SVR4
1.3 ! noro 774: # ifdef __arch64__
! 775: # define STACKBOTTOM ((ptr_t) 0x80000000000ULL)
! 776: # define DATASTART (ptr_t)GC_SysVGetDataStart(0x100000, &_etext)
! 777: # define CPP_WORDSZ 64
! 778: # else
! 779: # define STACKBOTTOM ((ptr_t) 0xf0000000)
! 780: # define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
! 781: # endif
1.1 noro 782: # endif
783: # ifdef OPENBSD
784: # define OS_TYPE "OPENBSD"
785: # define STACKBOTTOM ((ptr_t) 0xf8000000)
1.3 ! noro 786: extern int etext;
1.1 noro 787: # define DATASTART ((ptr_t)(&etext))
788: # endif
1.3 ! noro 789: # ifdef NETBSD
! 790: # define OS_TYPE "NETBSD"
! 791: # define HEURISTIC2
! 792: # ifdef __ELF__
! 793: # define DATASTART GC_data_start
! 794: # define DYNAMIC_LOADING
! 795: # else
! 796: extern char etext;
! 797: # define DATASTART ((ptr_t)(&etext))
! 798: # endif
! 799: # endif
1.1 noro 800: # endif
801:
802: # ifdef I386
803: # define MACH_TYPE "I386"
804: # define ALIGNMENT 4 /* Appears to hold for all "32 bit" compilers */
805: /* except Borland. The -a4 option fixes */
806: /* Borland. */
807: /* Ivan Demakov: For Watcom the option is -zp4. */
808: # ifndef SMALL_CONFIG
809: # define ALIGN_DOUBLE /* Not strictly necessary, but may give speed */
810: /* improvement on Pentiums. */
811: # endif
812: # ifdef SEQUENT
813: # define OS_TYPE "SEQUENT"
814: extern int etext;
815: # define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
816: # define STACKBOTTOM ((ptr_t) 0x3ffff000)
817: # endif
1.3 ! noro 818: # ifdef BEOS
! 819: # define OS_TYPE "BEOS"
! 820: # include <OS.h>
! 821: # define GETPAGESIZE() B_PAGE_SIZE
! 822: extern int etext;
! 823: # define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
! 824: # endif
1.1 noro 825: # ifdef SUNOS5
826: # define OS_TYPE "SUNOS5"
827: extern int etext, _start;
828: extern char * GC_SysVGetDataStart();
829: # define DATASTART GC_SysVGetDataStart(0x1000, &etext)
1.3 ! noro 830: /* # define STACKBOTTOM ((ptr_t)(&_start)) worked through 2.7, */
! 831: /* but reportedly breaks under 2.8. It appears that the stack */
! 832: /* base is a property of the executable, so this should not break */
! 833: /* old executables. */
! 834: /* HEURISTIC2 probably works, but this appears to be preferable. */
! 835: # include <sys/vmparam.h>
! 836: # define STACKBOTTOM USRSTACK
1.1 noro 837: /** At least in Solaris 2.5, PROC_VDB gives wrong values for dirty bits. */
838: /*# define PROC_VDB*/
839: # define DYNAMIC_LOADING
840: # ifndef USE_MMAP
841: # define USE_MMAP
842: # endif
843: # ifdef USE_MMAP
844: # define HEAP_START (ptr_t)0x40000000
845: # else
846: # define HEAP_START DATAEND
847: # endif
848: # endif
849: # ifdef SCO
850: # define OS_TYPE "SCO"
851: extern int etext;
852: # define DATASTART ((ptr_t)((((word) (&etext)) + 0x3fffff) \
853: & ~0x3fffff) \
854: +((word)&etext & 0xfff))
855: # define STACKBOTTOM ((ptr_t) 0x7ffffffc)
856: # endif
857: # ifdef SCO_ELF
858: # define OS_TYPE "SCO_ELF"
859: extern int etext;
860: # define DATASTART ((ptr_t)(&etext))
861: # define STACKBOTTOM ((ptr_t) 0x08048000)
862: # define DYNAMIC_LOADING
863: # define ELF_CLASS ELFCLASS32
864: # endif
865: # ifdef LINUX
866: # define OS_TYPE "LINUX"
1.3 ! noro 867: # define LINUX_STACKBOTTOM
! 868: # if 0
! 869: # define HEURISTIC1
! 870: # undef STACK_GRAN
! 871: # define STACK_GRAN 0x10000000
! 872: /* STACKBOTTOM is usually 0xc0000000, but this changes with */
! 873: /* different kernel configurations. In particular, systems */
! 874: /* with 2GB physical memory will usually move the user */
! 875: /* address space limit, and hence initial SP to 0x80000000. */
! 876: # endif
1.1 noro 877: # if !defined(LINUX_THREADS) || !defined(REDIRECT_MALLOC)
878: # define MPROTECT_VDB
879: # else
880: /* We seem to get random errors in incremental mode, */
881: /* possibly because Linux threads is itself a malloc client */
882: /* and can't deal with the signals. */
883: # endif
884: # ifdef __ELF__
885: # define DYNAMIC_LOADING
886: # ifdef UNDEFINED /* includes ro data */
887: extern int _etext;
888: # define DATASTART ((ptr_t)((((word) (&_etext)) + 0xfff) & ~0xfff))
889: # endif
890: # include <features.h>
891: # if defined(__GLIBC__) && __GLIBC__ >= 2
1.3 ! noro 892: # define LINUX_DATA_START
1.1 noro 893: # else
894: extern char **__environ;
895: # define DATASTART ((ptr_t)(&__environ))
896: /* hideous kludge: __environ is the first */
897: /* word in crt0.o, and delimits the start */
898: /* of the data segment, no matter which */
899: /* ld options were passed through. */
900: /* We could use _etext instead, but that */
901: /* would include .rodata, which may */
902: /* contain large read-only data tables */
903: /* that we'd rather not scan. */
904: # endif
905: extern int _end;
906: # define DATAEND (&_end)
907: # else
908: extern int etext;
909: # define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
910: # endif
1.3 ! noro 911: # ifdef USE_I686_PREFETCH
! 912: # define PREFETCH(x) \
! 913: __asm__ __volatile__ (" prefetchnta %0": : "m"(*(char *)(x)))
! 914: /* Empirically prefetcht0 is much more effective at reducing */
! 915: /* cache miss stalls for the targetted load instructions. But it */
! 916: /* seems to interfere enough with other cache traffic that the net */
! 917: /* result is worse than prefetchnta. */
! 918: # if 0
! 919: /* Using prefetches for write seems to have a slight negative */
! 920: /* impact on performance, at least for a PIII/500. */
! 921: # define PREFETCH_FOR_WRITE(x) \
! 922: __asm__ __volatile__ (" prefetcht0 %0": : "m"(*(char *)(x)))
! 923: # endif
! 924: # endif
! 925: # ifdef USE_3DNOW_PREFETCH
! 926: # define PREFETCH(x) \
! 927: __asm__ __volatile__ (" prefetch %0": : "m"(*(char *)(x)))
! 928: # define PREFETCH_FOR_WRITE(x) \
! 929: __asm__ __volatile__ (" prefetchw %0": : "m"(*(char *)(x)))
! 930: # endif
1.1 noro 931: # endif
932: # ifdef CYGWIN32
933: # define OS_TYPE "CYGWIN32"
934: extern int _data_start__;
935: extern int _data_end__;
936: extern int _bss_start__;
937: extern int _bss_end__;
938: /* For binutils 2.9.1, we have */
939: /* DATASTART = _data_start__ */
940: /* DATAEND = _bss_end__ */
941: /* whereas for some earlier versions it was */
942: /* DATASTART = _bss_start__ */
943: /* DATAEND = _data_end__ */
944: /* To get it right for both, we take the */
945: /* minumum/maximum of the two. */
946: # define MAX(x,y) ((x) > (y) ? (x) : (y))
947: # define MIN(x,y) ((x) < (y) ? (x) : (y))
948: # define DATASTART ((ptr_t) MIN(&_data_start__, &_bss_start__))
949: # define DATAEND ((ptr_t) MAX(&_data_end__, &_bss_end__))
950: # undef STACK_GRAN
951: # define STACK_GRAN 0x10000
952: # define HEURISTIC1
953: # endif
954: # ifdef OS2
955: # define OS_TYPE "OS2"
956: /* STACKBOTTOM and DATASTART are handled specially in */
957: /* os_dep.c. OS2 actually has the right */
958: /* system call! */
959: # define DATAEND /* not needed */
1.3 ! noro 960: # define USE_GENERIC_PUSH_REGS
1.1 noro 961: # endif
962: # ifdef MSWIN32
963: # define OS_TYPE "MSWIN32"
964: /* STACKBOTTOM and DATASTART are handled specially in */
965: /* os_dep.c. */
966: # ifndef __WATCOMC__
967: # define MPROTECT_VDB
968: # endif
969: # define DATAEND /* not needed */
970: # endif
1.3 ! noro 971: # ifdef MSWINCE
! 972: # define OS_TYPE "MSWINCE"
! 973: # define DATAEND /* not needed */
! 974: # endif
1.1 noro 975: # ifdef DJGPP
976: # define OS_TYPE "DJGPP"
977: # include "stubinfo.h"
978: extern int etext;
979: extern int _stklen;
980: extern int __djgpp_stack_limit;
981: # define DATASTART ((ptr_t)((((word) (&etext)) + 0x1ff) & ~0x1ff))
982: /* # define STACKBOTTOM ((ptr_t)((word) _stubinfo + _stubinfo->size \
983: + _stklen)) */
984: # define STACKBOTTOM ((ptr_t)((word) __djgpp_stack_limit + _stklen))
985: /* This may not be right. */
986: # endif
987: # ifdef OPENBSD
988: # define OS_TYPE "OPENBSD"
989: # endif
990: # ifdef FREEBSD
991: # define OS_TYPE "FREEBSD"
992: # define MPROTECT_VDB
1.3 ! noro 993: # define FREEBSD_STACKBOTTOM
1.1 noro 994: # endif
995: # ifdef NETBSD
996: # define OS_TYPE "NETBSD"
997: # endif
998: # ifdef THREE86BSD
999: # define OS_TYPE "THREE86BSD"
1000: # endif
1001: # ifdef BSDI
1002: # define OS_TYPE "BSDI"
1003: # endif
1.3 ! noro 1004: # if defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) \
1.1 noro 1005: || defined(THREE86BSD) || defined(BSDI)
1006: # define HEURISTIC2
1007: extern char etext;
1008: # define DATASTART ((ptr_t)(&etext))
1009: # endif
1010: # ifdef NEXT
1011: # define OS_TYPE "NEXT"
1012: # define DATASTART ((ptr_t) get_etext())
1013: # define STACKBOTTOM ((ptr_t)0xc0000000)
1014: # define DATAEND /* not needed */
1015: # endif
1016: # ifdef DOS4GW
1017: # define OS_TYPE "DOS4GW"
1018: extern long __nullarea;
1019: extern char _end;
1020: extern char *_STACKTOP;
1021: /* Depending on calling conventions Watcom C either precedes
1022: or does not precedes with undescore names of C-variables.
1023: Make sure startup code variables always have the same names. */
1024: #pragma aux __nullarea "*";
1025: #pragma aux _end "*";
1026: # define STACKBOTTOM ((ptr_t) _STACKTOP)
1027: /* confused? me too. */
1028: # define DATASTART ((ptr_t) &__nullarea)
1029: # define DATAEND ((ptr_t) &_end)
1030: # endif
1031: # endif
1032:
1033: # ifdef NS32K
1034: # define MACH_TYPE "NS32K"
1035: # define ALIGNMENT 4
1036: extern char **environ;
1037: # define DATASTART ((ptr_t)(&environ))
1038: /* hideous kludge: environ is the first */
1039: /* word in crt0.o, and delimits the start */
1040: /* of the data segment, no matter which */
1041: /* ld options were passed through. */
1042: # define STACKBOTTOM ((ptr_t) 0xfffff000) /* for Encore */
1043: # endif
1044:
1045: # ifdef MIPS
1046: # define MACH_TYPE "MIPS"
1.3 ! noro 1047: /* # define STACKBOTTOM ((ptr_t)0x7fff8000) sometimes also works. */
! 1048: # ifdef LINUX
! 1049: /* This was developed for a linuxce style platform. Probably */
! 1050: /* needs to be tweaked for workstation class machines. */
! 1051: # define OS_TYPE "LINUX"
! 1052: extern int __data_start;
! 1053: # define DATASTART ((ptr_t)(&__data_start))
! 1054: # define ALIGNMENT 4
! 1055: # define USE_GENERIC_PUSH_REGS 1
! 1056: # define STACKBOTTOM 0x80000000
! 1057: /* In many cases, this should probably use LINUX_STACKBOTTOM */
! 1058: /* instead. But some kernel versions seem to give the wrong */
! 1059: /* value from /proc. */
! 1060: # endif /* Linux */
! 1061: # ifdef ULTRIX
! 1062: # define HEURISTIC2
! 1063: # define DATASTART (ptr_t)0x10000000
1.1 noro 1064: /* Could probably be slightly higher since */
1065: /* startup code allocates lots of stuff. */
1066: # define OS_TYPE "ULTRIX"
1067: # define ALIGNMENT 4
1068: # endif
1069: # ifdef RISCOS
1.3 ! noro 1070: # define HEURISTIC2
! 1071: # define DATASTART (ptr_t)0x10000000
1.1 noro 1072: # define OS_TYPE "RISCOS"
1073: # define ALIGNMENT 4 /* Required by hardware */
1074: # endif
1075: # ifdef IRIX5
1.3 ! noro 1076: # define HEURISTIC2
! 1077: extern int _fdata;
! 1078: # define DATASTART ((ptr_t)(&_fdata))
! 1079: # ifdef USE_MMAP
! 1080: # define HEAP_START (ptr_t)0x30000000
! 1081: # else
! 1082: # define HEAP_START DATASTART
! 1083: # endif
! 1084: /* Lowest plausible heap address. */
! 1085: /* In the MMAP case, we map there. */
! 1086: /* In either case it is used to identify */
! 1087: /* heap sections so they're not */
! 1088: /* considered as roots. */
1.1 noro 1089: # define OS_TYPE "IRIX5"
1090: # define MPROTECT_VDB
1091: # ifdef _MIPS_SZPTR
1092: # define CPP_WORDSZ _MIPS_SZPTR
1093: # define ALIGNMENT (_MIPS_SZPTR/8)
1094: # if CPP_WORDSZ != 64
1095: # define ALIGN_DOUBLE
1096: # endif
1097: # else
1098: # define ALIGNMENT 4
1099: # define ALIGN_DOUBLE
1100: # endif
1101: # define DYNAMIC_LOADING
1102: # endif
1.3 ! noro 1103: # ifdef MSWINCE
! 1104: # define OS_TYPE "MSWINCE"
! 1105: # define ALIGNMENT 4
! 1106: # define DATAEND /* not needed */
! 1107: # endif
! 1108: # if defined(NETBSD)
! 1109: /* This also checked for __MIPSEL__ . Why? NETBSD recognition */
! 1110: /* should be handled at the top of the file. */
! 1111: # define ALIGNMENT 4
! 1112: # define OS_TYPE "NETBSD"
! 1113: # define HEURISTIC2
! 1114: # define USE_GENERIC_PUSH_REGS 1
! 1115: # ifdef __ELF__
! 1116: extern int etext;
! 1117: # define DATASTART GC_data_start
! 1118: # define NEED_FIND_LIMIT
! 1119: # define DYNAMIC_LOADING
! 1120: # else
! 1121: # define DATASTART ((ptr_t) 0x10000000)
! 1122: # define STACKBOTTOM ((ptr_t) 0x7ffff000)
! 1123: # endif /* _ELF_ */
! 1124: # endif
1.1 noro 1125: # endif
1126:
1127: # ifdef RS6000
1128: # define MACH_TYPE "RS6000"
1129: # define ALIGNMENT 4
1130: # define DATASTART ((ptr_t)0x20000000)
1131: extern int errno;
1132: # define STACKBOTTOM ((ptr_t)((ulong)&errno))
1133: # define DYNAMIC_LOADING
1134: /* For really old versions of AIX, this may have to be removed. */
1135: # endif
1136:
1137: # ifdef HP_PA
1138: # define MACH_TYPE "HP_PA"
1.3 ! noro 1139: # define OS_TYPE "HPUX"
! 1140: # ifdef __LP64__
! 1141: # define CPP_WORDSZ 64
! 1142: # define ALIGNMENT 8
! 1143: # else
! 1144: # define CPP_WORDSZ 32
! 1145: # define ALIGNMENT 4
! 1146: # define ALIGN_DOUBLE
! 1147: # endif
! 1148: # if !defined(GC_HPUX_THREADS) && !defined(HPUX_THREADS) \
! 1149: && !defined(GC_LINUX_THREADS) && !defined(LINUX_THREADS)
! 1150: # ifndef LINUX /* For now. */
! 1151: # define MPROTECT_VDB
! 1152: # endif
! 1153: # else
! 1154: # define GENERIC_COMPARE_AND_SWAP
! 1155: /* No compare-and-swap instruction. Use pthread mutexes */
! 1156: /* when we absolutely have to. */
! 1157: # ifdef PARALLEL_MARK
! 1158: # define USE_MARK_BYTES
! 1159: /* Minimize compare-and-swap usage. */
! 1160: # endif
! 1161: # endif
! 1162: # define STACK_GROWS_UP
! 1163: # ifdef HPUX
! 1164: extern int __data_start;
! 1165: # define DATASTART ((ptr_t)(&__data_start))
! 1166: # if 0
1.1 noro 1167: /* The following appears to work for 7xx systems running HP/UX */
1168: /* 9.xx Furthermore, it might result in much faster */
1169: /* collections than HEURISTIC2, which may involve scanning */
1170: /* segments that directly precede the stack. It is not the */
1171: /* default, since it may not work on older machine/OS */
1172: /* combinations. (Thanks to Raymond X.T. Nijssen for uncovering */
1173: /* this.) */
1174: # define STACKBOTTOM ((ptr_t) 0x7b033000) /* from /etc/conf/h/param.h */
1.3 ! noro 1175: # else
! 1176: /* Gustavo Rodriguez-Rivera suggested changing HEURISTIC2 */
! 1177: /* to this. Note that the GC must be initialized before the */
! 1178: /* first putenv call. */
! 1179: extern char ** environ;
! 1180: # define STACKBOTTOM ((ptr_t)environ)
! 1181: # endif
! 1182: # define DYNAMIC_LOADING
! 1183: # include <unistd.h>
! 1184: # define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
! 1185: # ifndef __GNUC__
! 1186: # define PREFETCH(x) { \
! 1187: register long addr = (long)(x); \
! 1188: (void) _asm ("LDW", 0, 0, addr, 0); \
! 1189: }
! 1190: # endif
! 1191: # endif /* HPUX */
! 1192: # ifdef LINUX
! 1193: # define OS_TYPE "LINUX"
! 1194: # define LINUX_STACKBOTTOM
! 1195: # define DYNAMIC_LOADING
! 1196: # define LINUX_DATA_START
! 1197: extern int _end;
! 1198: # define DATAEND (&_end)
! 1199: # endif /* LINUX */
! 1200: # endif /* HP_PA */
1.1 noro 1201:
1202: # ifdef ALPHA
1203: # define MACH_TYPE "ALPHA"
1204: # define ALIGNMENT 8
1.3 ! noro 1205: # define USE_GENERIC_PUSH_REGS
! 1206: /* Gcc and probably the DEC/Compaq compiler spill pointers to preserved */
! 1207: /* fp registers in some cases when the target is a 21264. The assembly */
! 1208: /* code doesn't handle that yet, and version dependencies make that a */
! 1209: /* bit tricky. Do the easy thing for now. */
! 1210: # ifdef NETBSD
! 1211: # define OS_TYPE "NETBSD"
! 1212: # define HEURISTIC2
! 1213: # define DATASTART GC_data_start
! 1214: # define ELFCLASS32 32
! 1215: # define ELFCLASS64 64
! 1216: # define ELF_CLASS ELFCLASS64
! 1217: # define CPP_WORDSZ 64
! 1218: # define DYNAMIC_LOADING
! 1219: # endif
1.1 noro 1220: # ifdef OSF1
1221: # define OS_TYPE "OSF1"
1222: # define DATASTART ((ptr_t) 0x140000000)
1.3 ! noro 1223: extern int _end;
1.1 noro 1224: # define DATAEND ((ptr_t) &_end)
1.3 ! noro 1225: extern char ** environ;
! 1226: /* round up from the value of environ to the nearest page boundary */
! 1227: /* Probably breaks if putenv is called before collector */
! 1228: /* initialization. */
! 1229: # define STACKBOTTOM ((ptr_t)(((word)(environ) | (getpagesize()-1))+1))
! 1230: /* # define HEURISTIC2 */
1.1 noro 1231: /* Normally HEURISTIC2 is too conervative, since */
1232: /* the text segment immediately follows the stack. */
1233: /* Hence we give an upper pound. */
1.3 ! noro 1234: /* This is currently unused, since we disabled HEURISTIC2 */
1.1 noro 1235: extern int __start;
1236: # define HEURISTIC2_LIMIT ((ptr_t)((word)(&__start) & ~(getpagesize()-1)))
1237: # define CPP_WORDSZ 64
1238: # define MPROTECT_VDB
1239: # define DYNAMIC_LOADING
1240: # endif
1241: # ifdef LINUX
1242: # define OS_TYPE "LINUX"
1243: # define CPP_WORDSZ 64
1244: # define STACKBOTTOM ((ptr_t) 0x120000000)
1245: # ifdef __ELF__
1.3 ! noro 1246: # define SEARCH_FOR_DATA_START
! 1247: # define DATASTART GC_data_start
1.1 noro 1248: # define DYNAMIC_LOADING
1249: # else
1250: # define DATASTART ((ptr_t) 0x140000000)
1251: # endif
1252: extern int _end;
1253: # define DATAEND (&_end)
1254: # define MPROTECT_VDB
1255: /* Has only been superficially tested. May not */
1256: /* work on all versions. */
1257: # endif
1258: # endif
1259:
1.3 ! noro 1260: # ifdef IA64
! 1261: # define MACH_TYPE "IA64"
! 1262: # define ALIGN_DOUBLE
! 1263: /* Requires 16 byte alignment for malloc */
! 1264: # define ALIGNMENT 8
! 1265: # define USE_GENERIC_PUSH_REGS
! 1266: /* We need to get preserved registers in addition to register */
! 1267: /* windows. That's easiest to do with setjmp. */
! 1268: # ifdef PARALLEL_MARK
! 1269: # define USE_MARK_BYTES
! 1270: /* Compare-and-exchange is too expensive to use for */
! 1271: /* setting mark bits. */
! 1272: # endif
! 1273: # ifdef HPUX
! 1274: --> needs work
! 1275: # endif
! 1276: # ifdef LINUX
! 1277: # define OS_TYPE "LINUX"
! 1278: # define CPP_WORDSZ 64
! 1279: /* The following works on NUE and older kernels: */
! 1280: /* # define STACKBOTTOM ((ptr_t) 0xa000000000000000l) */
! 1281: /* This does not work on NUE: */
! 1282: # define LINUX_STACKBOTTOM
! 1283: /* We also need the base address of the register stack */
! 1284: /* backing store. This is computed in */
! 1285: /* GC_linux_register_stack_base based on the following */
! 1286: /* constants: */
! 1287: # define BACKING_STORE_ALIGNMENT 0x100000
! 1288: # define BACKING_STORE_DISPLACEMENT 0x80000000
! 1289: extern char * GC_register_stackbottom;
! 1290: # define BACKING_STORE_BASE ((ptr_t)GC_register_stackbottom)
! 1291: # define SEARCH_FOR_DATA_START
! 1292: # define DATASTART GC_data_start
! 1293: # define DYNAMIC_LOADING
! 1294: # define MPROTECT_VDB
! 1295: /* Requires Linux 2.3.47 or later. */
! 1296: extern int _end;
! 1297: # define DATAEND (&_end)
! 1298: # ifdef __GNUC__
! 1299: # define PREFETCH(x) \
! 1300: __asm__ (" lfetch [%0]": : "r"((void *)(x)))
! 1301: # define PREFETCH_FOR_WRITE(x) \
! 1302: __asm__ (" lfetch.excl [%0]": : "r"((void *)(x)))
! 1303: # define CLEAR_DOUBLE(x) \
! 1304: __asm__ (" stf.spill [%0]=f0": : "r"((void *)(x)))
! 1305: # endif
! 1306: # endif
! 1307: # endif
! 1308:
1.1 noro 1309: # ifdef M88K
1310: # define MACH_TYPE "M88K"
1311: # define ALIGNMENT 4
1312: # define ALIGN_DOUBLE
1313: extern int etext;
1314: # ifdef CX_UX
1315: # define OS_TYPE "CX_UX"
1316: # define DATASTART ((((word)&etext + 0x3fffff) & ~0x3fffff) + 0x10000)
1317: # endif
1318: # ifdef DGUX
1319: # define OS_TYPE "DGUX"
1320: extern char * GC_SysVGetDataStart();
1321: # define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &etext)
1322: # endif
1323: # define STACKBOTTOM ((char*)0xf0000000) /* determined empirically */
1324: # endif
1325:
1326: # ifdef S370
1327: # define MACH_TYPE "S370"
1328: # define ALIGNMENT 4 /* Required by hardware */
1.3 ! noro 1329: # define USE_GENERIC_PUSH_REGS
! 1330: # ifdef UTS4
! 1331: # define OS_TYPE "UTS4"
! 1332: extern int etext;
1.1 noro 1333: extern int _etext;
1334: extern int _end;
1335: extern char * GC_SysVGetDataStart();
1336: # define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
1337: # define DATAEND (&_end)
1338: # define HEURISTIC2
1.3 ! noro 1339: # endif
! 1340: # ifdef LINUX
! 1341: # define OS_TYPE "LINUX"
! 1342: # define HEURISTIC1
! 1343: # define DYNAMIC_LOADING
! 1344: extern int __data_start;
! 1345: # define DATASTART ((ptr_t)(&__data_start))
! 1346: # endif
! 1347: # endif
! 1348:
! 1349: # if defined(PJ)
! 1350: # define ALIGNMENT 4
! 1351: extern int _etext;
! 1352: # define DATASTART ((ptr_t)(&_etext))
! 1353: # define HEURISTIC1
1.1 noro 1354: # endif
1355:
1.3 ! noro 1356: # ifdef ARM32
! 1357: # define CPP_WORDSZ 32
! 1358: # define MACH_TYPE "ARM32"
! 1359: # define ALIGNMENT 4
! 1360: # ifdef NETBSD
! 1361: # define OS_TYPE "NETBSD"
! 1362: # define HEURISTIC2
! 1363: extern char etext;
! 1364: # define DATASTART ((ptr_t)(&etext))
! 1365: # define USE_GENERIC_PUSH_REGS
! 1366: # endif
! 1367: # ifdef LINUX
! 1368: # define OS_TYPE "LINUX"
! 1369: # define HEURISTIC1
! 1370: # undef STACK_GRAN
! 1371: # define STACK_GRAN 0x10000000
! 1372: # define USE_GENERIC_PUSH_REGS
! 1373: # ifdef __ELF__
! 1374: # define DYNAMIC_LOADING
! 1375: # include <features.h>
! 1376: # if defined(__GLIBC__) && __GLIBC__ >= 2
! 1377: # define LINUX_DATA_START
! 1378: # else
! 1379: extern char **__environ;
! 1380: # define DATASTART ((ptr_t)(&__environ))
! 1381: /* hideous kludge: __environ is the first */
! 1382: /* word in crt0.o, and delimits the start */
! 1383: /* of the data segment, no matter which */
! 1384: /* ld options were passed through. */
! 1385: /* We could use _etext instead, but that */
! 1386: /* would include .rodata, which may */
! 1387: /* contain large read-only data tables */
! 1388: /* that we'd rather not scan. */
! 1389: # endif
! 1390: extern int _end;
! 1391: # define DATAEND (&_end)
! 1392: # else
! 1393: extern int etext;
! 1394: # define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
! 1395: # endif
! 1396: # endif
! 1397: # ifdef MSWINCE
! 1398: # define OS_TYPE "MSWINCE"
! 1399: # define DATAEND /* not needed */
! 1400: # endif
! 1401: #endif
! 1402:
! 1403: # ifdef SH
! 1404: # define MACH_TYPE "SH"
! 1405: # define ALIGNMENT 4
! 1406: # ifdef MSWINCE
! 1407: # define OS_TYPE "MSWINCE"
! 1408: # define DATAEND /* not needed */
! 1409: # endif
! 1410: # ifdef LINUX
! 1411: # define OS_TYPE "LINUX"
! 1412: # define STACKBOTTOM ((ptr_t) 0x7c000000)
! 1413: # define USE_GENERIC_PUSH_REGS
! 1414: # define DYNAMIC_LOADING
! 1415: # define LINUX_DATA_START
! 1416: extern int _end;
! 1417: # define DATAEND (&_end)
! 1418: # endif
! 1419: # endif
! 1420:
! 1421: # ifdef SH4
! 1422: # define MACH_TYPE "SH4"
! 1423: # define OS_TYPE "MSWINCE"
! 1424: # define ALIGNMENT 4
! 1425: # define DATAEND /* not needed */
! 1426: # endif
! 1427:
! 1428: #ifdef LINUX_DATA_START
! 1429: /* Some Linux distributions arrange to define __data_start. Some */
! 1430: /* define data_start as a weak symbol. The latter is technically */
! 1431: /* broken, since the user program may define data_start, in which */
! 1432: /* case we lose. Nonetheless, we try both, prefering __data_start. */
! 1433: /* We assume gcc. */
! 1434: # pragma weak __data_start
! 1435: extern int __data_start;
! 1436: # pragma weak data_start
! 1437: extern int data_start;
! 1438: # define DATASTART ((ptr_t)(&__data_start != 0? &__data_start : &data_start))
! 1439: #endif
! 1440:
! 1441: #if defined(LINUX) && defined(REDIRECT_MALLOC)
! 1442: /* Rld appears to allocate some memory with its own allocator, and */
! 1443: /* some through malloc, which might be redirected. To make this */
! 1444: /* work with collectable memory, we have to scan memory allocated */
! 1445: /* by rld's internal malloc. */
! 1446: # define USE_PROC_FOR_LIBRARIES
! 1447: #endif
! 1448:
1.1 noro 1449: # ifndef STACK_GROWS_UP
1450: # define STACK_GROWS_DOWN
1451: # endif
1452:
1453: # ifndef CPP_WORDSZ
1454: # define CPP_WORDSZ 32
1455: # endif
1456:
1457: # ifndef OS_TYPE
1458: # define OS_TYPE ""
1459: # endif
1460:
1461: # ifndef DATAEND
1462: extern int end;
1463: # define DATAEND (&end)
1464: # endif
1465:
1466: # if defined(SVR4) && !defined(GETPAGESIZE)
1467: # include <unistd.h>
1468: # define GETPAGESIZE() sysconf(_SC_PAGESIZE)
1469: # endif
1470:
1471: # ifndef GETPAGESIZE
1472: # if defined(SUNOS5) || defined(IRIX5)
1473: # include <unistd.h>
1474: # endif
1475: # define GETPAGESIZE() getpagesize()
1476: # endif
1477:
1478: # if defined(SUNOS5) || defined(DRSNX) || defined(UTS4)
1479: /* OS has SVR4 generic features. Probably others also qualify. */
1480: # define SVR4
1481: # endif
1482:
1483: # if defined(SUNOS5) || defined(DRSNX)
1484: /* OS has SUNOS5 style semi-undocumented interface to dynamic */
1485: /* loader. */
1486: # define SUNOS5DL
1487: /* OS has SUNOS5 style signal handlers. */
1488: # define SUNOS5SIGS
1489: # endif
1490:
1.3 ! noro 1491: # if defined(HPUX)
! 1492: # define SUNOS5SIGS
! 1493: # endif
! 1494:
! 1495: # if defined(SVR4) || defined(LINUX) || defined(IRIX) || defined(HPUX) \
! 1496: || defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) \
! 1497: || defined(BSD) || defined(AIX) || defined(MACOSX) || defined(OSF1)
! 1498: # define UNIX_LIKE /* Basic Unix-like system calls work. */
! 1499: # endif
! 1500:
1.1 noro 1501: # if CPP_WORDSZ != 32 && CPP_WORDSZ != 64
1502: -> bad word size
1503: # endif
1504:
1505: # ifdef PCR
1506: # undef DYNAMIC_LOADING
1507: # undef STACKBOTTOM
1508: # undef HEURISTIC1
1509: # undef HEURISTIC2
1510: # undef PROC_VDB
1511: # undef MPROTECT_VDB
1512: # define PCR_VDB
1513: # endif
1514:
1515: # ifdef SRC_M3
1516: /* Postponed for now. */
1517: # undef PROC_VDB
1518: # undef MPROTECT_VDB
1519: # endif
1520:
1521: # ifdef SMALL_CONFIG
1522: /* Presumably not worth the space it takes. */
1523: # undef PROC_VDB
1524: # undef MPROTECT_VDB
1525: # endif
1526:
1527: # ifdef USE_MUNMAP
1528: # undef MPROTECT_VDB /* Can't deal with address space holes. */
1529: # endif
1530:
1.3 ! noro 1531: # ifdef PARALLEL_MARK
! 1532: # undef MPROTECT_VDB /* For now. */
! 1533: # endif
! 1534:
1.1 noro 1535: # if !defined(PCR_VDB) && !defined(PROC_VDB) && !defined(MPROTECT_VDB)
1536: # define DEFAULT_VDB
1537: # endif
1538:
1.3 ! noro 1539: # ifndef PREFETCH
! 1540: # define PREFETCH(x)
! 1541: # define NO_PREFETCH
! 1542: # endif
! 1543:
! 1544: # ifndef PREFETCH_FOR_WRITE
! 1545: # define PREFETCH_FOR_WRITE(x)
! 1546: # define NO_PREFETCH_FOR_WRITE
! 1547: # endif
! 1548:
! 1549: # ifndef CACHE_LINE_SIZE
! 1550: # define CACHE_LINE_SIZE 32 /* Wild guess */
! 1551: # endif
! 1552:
! 1553: # ifndef CLEAR_DOUBLE
! 1554: # define CLEAR_DOUBLE(x) \
! 1555: ((word*)x)[0] = 0; \
! 1556: ((word*)x)[1] = 0;
! 1557: # endif /* CLEAR_DOUBLE */
! 1558:
! 1559: /* Internally to the collector we test only the XXX_THREADS macros */
! 1560: /* not the GC_XXX_THREADS versions. Here we make sure the latter */
! 1561: /* are treated as equivalent. */
! 1562: #if defined(GC_SOLARIS_THREADS) && !defined(_SOLARIS_THREADS)
! 1563: # define _SOLARIS_THREADS
! 1564: #endif
! 1565: #if defined(GC_SOLARIS_THREADS) && !defined(_SOLARIS_PTHREADS)
! 1566: # define _SOLARIS_PTHREADS
! 1567: #endif
! 1568: #if defined(GC_IRIX_THREADS) && !defined(IRIX_THREADS)
! 1569: # define IRIX_THREADS
! 1570: #endif
! 1571: #if defined(GC_LINUX_THREADS) && !defined(LINUX_THREADS)
! 1572: # define LINUX_THREADS
! 1573: #endif
! 1574: #if defined(GC_WIN32_THREADS) && !defined(WIN32_THREADS)
! 1575: # define WIN32_THREADS
! 1576: #endif
! 1577: #if defined(GC_HPUX_THREADS) && !defined(HPUX_THREADS)
! 1578: # define HPUX_THREADS
! 1579: #endif
! 1580: #if defined(GC_OSF1_THREADS) && !defined(OSF1_THREADS)
! 1581: # define OSF1_THREADS
! 1582: #endif
! 1583:
! 1584: /* Internally we use SOLARIS_THREADS to test for either old or pthreads. */
1.1 noro 1585: # if defined(_SOLARIS_PTHREADS) && !defined(SOLARIS_THREADS)
1586: # define SOLARIS_THREADS
1587: # endif
1588: # if defined(IRIX_THREADS) && !defined(IRIX5)
1589: --> inconsistent configuration
1590: # endif
1.3 ! noro 1591: # if defined(LINUX_THREADS) && !defined(LINUX)
1.1 noro 1592: --> inconsistent configuration
1593: # endif
1.3 ! noro 1594: # if defined(SOLARIS_THREADS) && !defined(SUNOS5)
1.1 noro 1595: --> inconsistent configuration
1596: # endif
1.3 ! noro 1597: # if defined(HPUX_THREADS) && !defined(HPUX)
1.1 noro 1598: --> inconsistent configuration
1599: # endif
1600: # if defined(PCR) || defined(SRC_M3) || \
1601: defined(SOLARIS_THREADS) || defined(WIN32_THREADS) || \
1602: defined(IRIX_THREADS) || defined(LINUX_THREADS) || \
1.3 ! noro 1603: defined(HPUX_THREADS) || defined(OSF1_THREADS)
1.1 noro 1604: # define THREADS
1605: # endif
1606:
1.3 ! noro 1607: # if defined(HP_PA) || defined(M88K) || defined(POWERPC) && !defined(MACOSX) \
! 1608: || defined(LINT) || defined(MSWINCE) \
! 1609: || (defined(I386) && defined(__LCC__))
! 1610: /* Use setjmp based hack to mark from callee-save registers. */
! 1611: /* The define should move to the individual platform */
! 1612: /* descriptions. */
1.1 noro 1613: # define USE_GENERIC_PUSH_REGS
1614: # endif
1.3 ! noro 1615: # if defined(I386) && defined(LINUX)
! 1616: /* SAVE_CALL_CHAIN is supported if the code is compiled to save */
! 1617: /* frame pointers by default, i.e. no -fomit-frame-pointer flag. */
! 1618: # ifdef SAVE_CALL_COUNT
! 1619: # define SAVE_CALL_CHAIN
! 1620: # endif
! 1621: # endif
! 1622: # if defined(SPARC)
1.1 noro 1623: # define SAVE_CALL_CHAIN
1624: # define ASM_CLEAR_CODE /* Stack clearing is crucial, and we */
1625: /* include assembly code to do it well. */
1626: # endif
1627:
1.3 ! noro 1628: # endif /* GCCONFIG_H */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>