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 * Copyright (c) 2000 by Hewlett-Packard Company. All rights reserved.
7 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
8 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
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.
21 /* Machine dependent parameters. Some tuning parameters can be found */
22 /* near the top of gc_private.h. */
24 /* Machine specific parts contributed by various people. See README file. */
26 /* First a unified test for Linux: */
27 # if defined(linux) || defined(__linux__)
31 /* And one for NetBSD: */
32 # if defined(__NetBSD__)
36 /* And one for OpenBSD: */
37 # if defined(__OpenBSD__)
41 /* Determine the machine type: */
42 # if defined(__XSCALE__)
46 # define mach_type_known
49 # if defined(sun) && defined(mc68000)
52 # define mach_type_known
54 # if defined(hp9000s300)
57 # define mach_type_known
59 # if defined(OPENBSD) && defined(m68k)
61 # define mach_type_known
63 # if defined(OPENBSD) && defined(__sparc__)
65 # define mach_type_known
67 # if defined(NETBSD) && defined(m68k)
69 # define mach_type_known
71 # if defined(NETBSD) && defined(__powerpc__)
73 # define mach_type_known
75 # if defined(NETBSD) && defined(__arm32__)
77 # define mach_type_known
86 # define mach_type_known
88 # if defined(mips) || defined(__mips)
91 # if defined(ultrix) || defined(__ultrix) || defined(__NetBSD__)
94 # if defined(_SYSTYPE_SVR4) || defined(SYSTYPE_SVR4) \
95 || defined(__SYSTYPE_SVR4__)
96 # define IRIX5 /* or IRIX 6.X */
98 # define RISCOS /* or IRIX 4.X */
102 # if defined(__NetBSD__) && defined(__MIPSEL__)
105 # define mach_type_known
107 # if defined(sequent) && (defined(i386) || defined(__i386__))
110 # define mach_type_known
112 # if defined(sun) && (defined(i386) || defined(__i386__))
115 # define mach_type_known
117 # if (defined(__OS2__) || defined(__EMX__)) && defined(__32BIT__)
120 # define mach_type_known
124 # define mach_type_known
126 # if defined(sun) && (defined(sparc) || defined(__sparc))
128 /* Test for SunOS 5.x */
135 # define mach_type_known
137 # if defined(sparc) && defined(unix) && !defined(sun) && !defined(linux) \
138 && !defined(__OpenBSD__) && !(__NetBSD__)
141 # define mach_type_known
145 # define mach_type_known
147 # if defined(__NetBSD__) && defined(__sparc__)
149 # define mach_type_known
151 # if defined(_M_XENIX) && defined(_M_SYSV) && defined(_M_I386)
152 /* The above test may need refinement */
154 # if defined(_SCO_ELF)
159 # define mach_type_known
161 # if defined(_AUX_SOURCE)
164 # define mach_type_known
166 # if defined(_PA_RISC1_0) || defined(_PA_RISC1_1) || defined(_PA_RISC2_0) \
167 || defined(hppa) || defined(__hppa__)
172 # define mach_type_known
174 # if defined(__ia64) && defined(_HPUX_SOURCE)
177 # define mach_type_known
179 # if defined(__BEOS__) && defined(_X86_)
182 # define mach_type_known
184 # if defined(LINUX) && (defined(i386) || defined(__i386__))
186 # define mach_type_known
188 # if defined(LINUX) && (defined(__ia64__) || defined(__ia64))
190 # define mach_type_known
192 # if defined(LINUX) && (defined(powerpc) || defined(__powerpc__))
194 # define mach_type_known
196 # if defined(LINUX) && defined(__mc68000__)
198 # define mach_type_known
200 # if defined(LINUX) && (defined(sparc) || defined(__sparc__))
202 # define mach_type_known
204 # if defined(LINUX) && defined(__arm__)
206 # define mach_type_known
208 # if defined(LINUX) && defined(__sh__)
210 # define mach_type_known
212 # if defined(__alpha) || defined(__alpha__)
214 # if !defined(LINUX) && !defined(NETBSD) && !defined(OPENBSD)
215 # define OSF1 /* a.k.a Digital Unix */
217 # define mach_type_known
219 # if defined(_AMIGA) && !defined(AMIGA)
224 # define mach_type_known
226 # if defined(THINK_C) || defined(__MWERKS__) && !defined(__powerc)
229 # define mach_type_known
231 # if defined(__MWERKS__) && defined(__powerc)
234 # define mach_type_known
236 # if defined(macosx) || \
237 defined(__APPLE__) && defined(__MACH__) && defined(__ppc__)
240 # define mach_type_known
242 # if defined(__APPLE__) && defined(__MACH__) && defined(__i386__)
245 --> Not really supported, but at least we recognize it.
247 # if defined(NeXT) && defined(mc68000)
250 # define mach_type_known
252 # if defined(NeXT) && (defined(i386) || defined(__i386__))
255 # define mach_type_known
257 # if defined(__OpenBSD__) && (defined(i386) || defined(__i386__))
260 # define mach_type_known
262 # if defined(__FreeBSD__) && (defined(i386) || defined(__i386__))
265 # define mach_type_known
267 # if defined(__NetBSD__) && (defined(i386) || defined(__i386__))
269 # define mach_type_known
271 # if defined(bsdi) && (defined(i386) || defined(__i386__))
274 # define mach_type_known
276 # if !defined(mach_type_known) && defined(__386BSD__)
279 # define mach_type_known
281 # if defined(_CX_UX) && defined(_M88K)
284 # define mach_type_known
289 # define mach_type_known
291 # if defined(_WIN32_WCE)
292 /* SH3, SH4, MIPS already defined for corresponding architectures */
293 # if defined(SH3) || defined(SH4)
303 # define mach_type_known
305 # if (defined(_MSDOS) || defined(_MSC_VER)) && (_M_IX86 >= 300) \
306 || defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__)
308 # define MSWIN32 /* or Win32s */
309 # define mach_type_known
312 # if defined(__DJGPP__)
315 # define DJGPP /* MSDOS running the DJGPP port of GCC */
317 # define mach_type_known
319 # if defined(__CYGWIN32__) || defined(__CYGWIN__)
322 # define mach_type_known
324 # if defined(__MINGW32__)
327 # define mach_type_known
329 # if defined(__BORLANDC__)
332 # define mach_type_known
334 # if defined(_UTS) && !defined(mach_type_known)
337 # define mach_type_known
341 # define mach_type_known
343 # if defined(__embedded__) && defined(PPC)
346 # define mach_type_known
349 # if defined(__WATCOMC__) && defined(__386__)
351 # if !defined(OS2) && !defined(MSWIN32) && !defined(DOS4GW)
352 # if defined(__OS2__)
355 # if defined(__WINDOWS_386__) || defined(__NT__)
362 # define mach_type_known
364 # if defined(__s390__) && defined(LINUX)
366 # define mach_type_known
368 # if defined(__GNU__)
369 # if defined(__i386__)
370 /* The Debian Hurd running on generic PC */
373 # define mach_type_known
377 /* Feel free to add more clauses here */
379 /* Or manually define the machine type here. A machine type is */
380 /* characterized by the architecture. Some */
381 /* machine types are further subdivided by OS. */
382 /* the macros ULTRIX, RISCOS, and BSD to distinguish. */
383 /* Note that SGI IRIX is treated identically to RISCOS. */
384 /* SYSV on an M68K actually means A/UX. */
385 /* The distinction in these cases is usually the stack starting address */
386 # ifndef mach_type_known
387 --> unknown machine type
389 /* Mapping is: M68K ==> Motorola 680X0 */
390 /* (SUNOS4,HP,NEXT, and SYSV (A/UX), */
391 /* MACOS and AMIGA variants) */
392 /* I386 ==> Intel 386 */
393 /* (SEQUENT, OS2, SCO, LINUX, NETBSD, */
394 /* FREEBSD, THREE86BSD, MSWIN32, */
395 /* BSDI,SUNOS5, NEXT, other variants) */
396 /* NS32K ==> Encore Multimax */
397 /* MIPS ==> R2000 or R3000 */
398 /* (RISCOS, ULTRIX variants) */
399 /* VAX ==> DEC VAX */
400 /* (BSD, ULTRIX variants) */
401 /* RS6000 ==> IBM RS/6000 AIX3.X */
402 /* RT ==> IBM PC/RT */
403 /* HP_PA ==> HP9000/700 & /800 */
405 /* SPARC ==> SPARC v7/v8/v9 */
406 /* (SUNOS4, SUNOS5, LINUX, */
407 /* DRSNX variants) */
408 /* ALPHA ==> DEC Alpha */
409 /* (OSF1 and LINUX variants) */
410 /* M88K ==> Motorola 88XX0 */
411 /* (CX_UX and DGUX) */
412 /* S370 ==> 370-like machine */
413 /* running Amdahl UTS4 */
414 /* or a 390 running LINUX */
415 /* ARM32 ==> Intel StrongARM */
416 /* IA64 ==> Intel IPF */
418 /* (LINUX and HPUX) */
419 /* IA64_32 ==> IA64 w/32 bit ABI */
421 /* SH ==> Hitachi SuperH */
422 /* (LINUX & MSWINCE) */
426 * For each architecture and OS, the following need to be defined:
428 * CPP_WORD_SZ is a simple integer constant representing the word size.
429 * in bits. We assume byte addressibility, where a byte has 8 bits.
430 * We also assume CPP_WORD_SZ is either 32 or 64.
431 * (We care about the length of pointers, not hardware
432 * bus widths. Thus a 64 bit processor with a C compiler that uses
433 * 32 bit pointers should use CPP_WORD_SZ of 32, not 64. Default is 32.)
435 * MACH_TYPE is a string representation of the machine type.
436 * OS_TYPE is analogous for the OS.
438 * ALIGNMENT is the largest N, such that
439 * all pointer are guaranteed to be aligned on N byte boundaries.
440 * defining it to be 1 will always work, but perform poorly.
442 * DATASTART is the beginning of the data segment.
443 * On UNIX systems, the collector will scan the area between DATASTART
444 * and DATAEND for root pointers.
446 * DATAEND, if not &end.
448 * ALIGN_DOUBLE of GC_malloc should return blocks aligned to twice
451 * STACKBOTTOM is the cool end of the stack, which is usually the
452 * highest address in the stack.
453 * Under PCR or OS/2, we have other ways of finding thread stacks.
454 * For each machine, the following should:
455 * 1) define STACK_GROWS_UP if the stack grows toward higher addresses, and
456 * 2) define exactly one of
457 * STACKBOTTOM (should be defined to be an expression)
460 * If either of the last two macros are defined, then STACKBOTTOM is computed
461 * during collector startup using one of the following two heuristics:
462 * HEURISTIC1: Take an address inside GC_init's frame, and round it up to
463 * the next multiple of STACK_GRAN.
464 * HEURISTIC2: Take an address inside GC_init's frame, increment it repeatedly
465 * in small steps (decrement if STACK_GROWS_UP), and read the value
466 * at each location. Remember the value when the first
467 * Segmentation violation or Bus error is signalled. Round that
468 * to the nearest plausible page boundary, and use that instead
471 * Gustavo Rodriguez-Rivera points out that on most (all?) Unix machines,
472 * the value of environ is a pointer that can serve as STACKBOTTOM.
473 * I expect that HEURISTIC2 can be replaced by this approach, which
474 * interferes far less with debugging. However it has the disadvantage
475 * that it's confused by a putenv call before the collector is initialized.
476 * This could be dealt with by intercepting putenv ...
478 * If no expression for STACKBOTTOM can be found, and neither of the above
479 * heuristics are usable, the collector can still be used with all of the above
480 * undefined, provided one of the following is done:
481 * 1) GC_mark_roots can be changed to somehow mark from the correct stack(s)
482 * without reference to STACKBOTTOM. This is appropriate for use in
483 * conjunction with thread packages, since there will be multiple stacks.
484 * (Allocating thread stacks in the heap, and treating them as ordinary
485 * heap data objects is also possible as a last resort. However, this is
486 * likely to introduce significant amounts of excess storage retention
487 * unless the dead parts of the thread stacks are periodically cleared.)
488 * 2) Client code may set GC_stackbottom before calling any GC_ routines.
489 * If the author of the client code controls the main program, this is
490 * easily accomplished by introducing a new main program, setting
491 * GC_stackbottom to the address of a local variable, and then calling
492 * the original main program. The new main program would read something
495 * # include "gc_private.h"
497 * main(argc, argv, envp)
499 * char **argv, **envp;
503 * GC_stackbottom = (ptr_t)(&dummy);
504 * return(real_main(argc, argv, envp));
508 * Each architecture may also define the style of virtual dirty bit
509 * implementation to be used:
510 * MPROTECT_VDB: Write protect the heap and catch faults.
511 * PROC_VDB: Use the SVR4 /proc primitives to read dirty bits.
513 * An architecture may define DYNAMIC_LOADING if dynamic_load.c
514 * defined GC_register_dynamic_libraries() for the architecture.
516 * An architecture may define PREFETCH(x) to preload the cache with *x.
517 * This defaults to a no-op.
519 * PREFETCH_FOR_WRITE(x) is used if *x is about to be written.
521 * An architecture may also define CLEAR_DOUBLE(x) to be a fast way to
522 * clear the two words at GC_malloc-aligned address x. By default,
523 * word stores of 0 are used instead.
526 /* If we are using a recent version of gcc, we can use __builtin_unwind_init()
527 * to push the relevant registers onto the stack. This generally makes
528 * USE_GENERIC_PUSH_REGS the preferred approach for marking from registers.
530 # if defined(__GNUC__) && ((__GNUC__ >= 3) || \
531 (__GNUC__ == 2 && __GNUC_MINOR__ >= 8))
532 # define HAVE_BUILTIN_UNWIND_INIT
535 # define STACK_GRAN 0x1000000
537 # define MACH_TYPE "M68K"
540 # define OS_TYPE "OPENBSD"
543 # define DATASTART ((ptr_t)(&etext))
546 # define OS_TYPE "NETBSD"
549 # define DATASTART ((ptr_t)(&etext))
552 # define OS_TYPE "LINUX"
553 # define STACKBOTTOM ((ptr_t)0xf0000000)
554 /* # define MPROTECT_VDB - Reported to not work 9/17/01 */
556 # define DYNAMIC_LOADING
557 # include <features.h>
558 # if defined(__GLIBC__)&& __GLIBC__>=2
559 # define LINUX_DATA_START
561 extern char **__environ;
562 # define DATASTART ((ptr_t)(&__environ))
563 /* hideous kludge: __environ is the first */
564 /* word in crt0.o, and delimits the start */
565 /* of the data segment, no matter which */
566 /* ld options were passed through. */
567 /* We could use _etext instead, but that */
568 /* would include .rodata, which may */
569 /* contain large read-only data tables */
570 /* that we'd rather not scan. */
571 # endif /* !GLIBC2 */
573 # define DATAEND (&_end)
576 # define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
580 # define OS_TYPE "SUNOS4"
582 # define DATASTART ((ptr_t)((((word) (&etext)) + 0x1ffff) & ~0x1ffff))
583 # define HEURISTIC1 /* differs */
584 # define DYNAMIC_LOADING
587 # define OS_TYPE "HP"
589 # define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
590 # define STACKBOTTOM ((ptr_t) 0xffeffffc)
591 /* empirically determined. seems to work. */
593 # define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
596 # define OS_TYPE "SYSV"
598 # define DATASTART ((ptr_t)((((word) (&etext)) + 0x3fffff) \
600 +((word)&etext & 0x1fff))
601 /* This only works for shared-text binaries with magic number 0413.
602 The other sorts of SysV binaries put the data at the end of the text,
603 in which case the default of &etext would work. Unfortunately,
604 handling both would require having the magic-number available.
607 # define STACKBOTTOM ((ptr_t)0xFFFFFFFE)
608 /* The stack starts at the top of memory, but */
609 /* 0x0 cannot be used as setjump_test complains */
610 /* that the stack direction is incorrect. Two */
611 /* bytes down from 0x0 should be safe enough. */
613 # include <sys/mmu.h>
614 # define GETPAGESIZE() PAGESIZE /* Is this still right? */
617 # define OS_TYPE "AMIGA"
618 /* STACKBOTTOM and DATASTART handled specially */
620 # define DATAEND /* not needed */
621 # define GETPAGESIZE() 4096
627 # define OS_TYPE "MACOS"
628 /* see os_dep.c for details of global data segments. */
629 # define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
630 # define DATAEND /* not needed */
631 # define GETPAGESIZE() 4096
634 # define OS_TYPE "NEXT"
635 # define DATASTART ((ptr_t) get_etext())
636 # define STACKBOTTOM ((ptr_t) 0x4000000)
637 # define DATAEND /* not needed */
642 # define MACH_TYPE "POWERPC"
644 # define ALIGNMENT 2 /* Still necessary? Could it be 4? */
648 # define OS_TYPE "MACOS"
649 /* see os_dep.c for details of global data segments. */
650 # define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
651 # define DATAEND /* not needed */
654 # define ALIGNMENT 4 /* Guess. Can someone verify? */
655 /* This was 2, but that didn't sound right. */
656 # define OS_TYPE "LINUX"
658 # define DYNAMIC_LOADING
660 # define STACK_GRAN 0x10000000
661 /* Stack usually starts at 0x80000000 */
662 # define LINUX_DATA_START
664 # define DATAEND (&_end)
667 /* There are reasons to suspect this may not be reliable. */
669 # define OS_TYPE "MACOSX"
670 # define DATASTART ((ptr_t) get_etext())
671 # define STACKBOTTOM ((ptr_t) 0xc0000000)
672 # define DATAEND /* not needed */
673 # define MPROTECT_VDB
675 # define GETPAGESIZE() getpagesize()
679 # define OS_TYPE "NETBSD"
682 # define DATASTART GC_data_start
683 # define DYNAMIC_LOADING
687 # define OS_TYPE "NOSYS"
688 extern void __end, __dso_handle;
689 # define DATASTART (&__dso_handle) /* OK, that's ugly. */
690 # define DATAEND (&__end)
691 /* Stack starts at 0xE0000000 for the simulator. */
693 # define STACK_GRAN 0x10000000
699 # define MACH_TYPE "VAX"
700 # define ALIGNMENT 4 /* Pointers are longword aligned by 4.2 C compiler */
702 # define DATASTART ((ptr_t)(&etext))
704 # define OS_TYPE "BSD"
706 /* HEURISTIC2 may be OK, but it's hard to test. */
709 # define OS_TYPE "ULTRIX"
710 # define STACKBOTTOM ((ptr_t) 0x7fffc800)
715 # define MACH_TYPE "RT"
717 # define DATASTART ((ptr_t) 0x10000000)
718 # define STACKBOTTOM ((ptr_t) 0x1fffd800)
722 # define MACH_TYPE "SPARC"
723 # if defined(__arch64__) || defined(__sparcv9)
725 # define CPP_WORDSZ 64
726 # define ELF_CLASS ELFCLASS64
728 # define ALIGNMENT 4 /* Required by hardware */
730 # define ALIGN_DOUBLE
732 # define OS_TYPE "SUNOS5"
735 extern char * GC_SysVGetDataStart();
736 # define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
737 # define DATAEND (&_end)
742 # define HEAP_START (ptr_t)0x40000000
744 # define HEAP_START DATAEND
747 /* HEURISTIC1 reportedly no longer works under 2.7. */
748 /* HEURISTIC2 probably works, but this appears to be preferable. */
749 /* Apparently USRSTACK is defined to be USERLIMIT, but in some */
750 /* installations that's undefined. We work around this with a */
752 # include <sys/vmparam.h>
754 /* This should work everywhere, but doesn't. */
755 # define STACKBOTTOM USRSTACK
760 # define GETPAGESIZE() sysconf(_SC_PAGESIZE)
761 /* getpagesize() appeared to be missing from at least one */
762 /* Solaris 5.4 installation. Weird. */
763 # define DYNAMIC_LOADING
766 # define OS_TYPE "SUNOS4"
767 /* [If you have a weak stomach, don't read this.] */
768 /* We would like to use: */
769 /* # define DATASTART ((ptr_t)((((word) (&etext)) + 0x1fff) & ~0x1fff)) */
770 /* This fails occasionally, due to an ancient, but very */
771 /* persistent ld bug. &etext is set 32 bytes too high. */
772 /* We instead read the text segment size from the a.out */
773 /* header, which happens to be mapped into our address space */
774 /* at the start of the text segment. The detective work here */
775 /* was done by Robert Ehrlich, Manuel Serrano, and Bernard */
776 /* Serpette of INRIA. */
777 /* This assumes ZMAGIC, i.e. demand-loadable executables. */
778 # define TEXTSTART 0x2000
779 # define DATASTART ((ptr_t)(*(int *)(TEXTSTART+0x4)+TEXTSTART))
780 # define MPROTECT_VDB
782 # define DYNAMIC_LOADING
785 # define CPP_WORDSZ 32
786 # define OS_TYPE "DRSNX"
787 extern char * GC_SysVGetDataStart();
789 # define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &etext)
790 # define MPROTECT_VDB
791 # define STACKBOTTOM ((ptr_t) 0xdfff0000)
792 # define DYNAMIC_LOADING
795 # define OS_TYPE "LINUX"
797 # define DYNAMIC_LOADING
799 Linux Sparc/a.out not supported
803 # define DATAEND (&_end)
806 # define STACKBOTTOM ((ptr_t) 0x80000000000ULL)
807 # define DATASTART (ptr_t)GC_SysVGetDataStart(0x100000, &_etext)
808 # define CPP_WORDSZ 64
810 # define STACKBOTTOM ((ptr_t) 0xf0000000)
811 # define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
815 # define OS_TYPE "OPENBSD"
816 # define STACKBOTTOM ((ptr_t) 0xf8000000)
818 # define DATASTART ((ptr_t)(&etext))
821 # define OS_TYPE "NETBSD"
824 # define DATASTART GC_data_start
825 # define DYNAMIC_LOADING
828 # define DATASTART ((ptr_t)(&etext))
834 # define MACH_TYPE "I386"
835 # define ALIGNMENT 4 /* Appears to hold for all "32 bit" compilers */
836 /* except Borland. The -a4 option fixes */
838 /* Ivan Demakov: For Watcom the option is -zp4. */
839 # ifndef SMALL_CONFIG
840 # define ALIGN_DOUBLE /* Not strictly necessary, but may give speed */
841 /* improvement on Pentiums. */
843 # ifdef HAVE_BUILTIN_UNWIND_INIT
844 # define USE_GENERIC_PUSH_REGS
847 # define OS_TYPE "SEQUENT"
849 # define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
850 # define STACKBOTTOM ((ptr_t) 0x3ffff000)
853 # define OS_TYPE "BEOS"
855 # define GETPAGESIZE() B_PAGE_SIZE
857 # define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
860 # define OS_TYPE "SUNOS5"
861 extern int _etext, _end;
862 extern char * GC_SysVGetDataStart();
863 # define DATASTART GC_SysVGetDataStart(0x1000, &_etext)
864 # define DATAEND (&_end)
865 /* # define STACKBOTTOM ((ptr_t)(&_start)) worked through 2.7, */
866 /* but reportedly breaks under 2.8. It appears that the stack */
867 /* base is a property of the executable, so this should not break */
868 /* old executables. */
869 /* HEURISTIC2 probably works, but this appears to be preferable. */
870 # include <sys/vmparam.h>
871 # define STACKBOTTOM USRSTACK
872 /** At least in Solaris 2.5, PROC_VDB gives wrong values for dirty bits. */
873 # ifdef SOLARIS25_PROC_VDB_BUG_FIXED
876 # define DYNAMIC_LOADING
881 # define HEAP_START (ptr_t)0x40000000
883 # define HEAP_START DATAEND
887 # define OS_TYPE "SCO"
889 # define DATASTART ((ptr_t)((((word) (&etext)) + 0x3fffff) \
891 +((word)&etext & 0xfff))
892 # define STACKBOTTOM ((ptr_t) 0x7ffffffc)
895 # define OS_TYPE "SCO_ELF"
897 # define DATASTART ((ptr_t)(&etext))
898 # define STACKBOTTOM ((ptr_t) 0x08048000)
899 # define DYNAMIC_LOADING
900 # define ELF_CLASS ELFCLASS32
903 # define OS_TYPE "LINUX"
904 # define LINUX_STACKBOTTOM
908 # define STACK_GRAN 0x10000000
909 /* STACKBOTTOM is usually 0xc0000000, but this changes with */
910 /* different kernel configurations. In particular, systems */
911 /* with 2GB physical memory will usually move the user */
912 /* address space limit, and hence initial SP to 0x80000000. */
914 # if !defined(GC_LINUX_THREADS) || !defined(REDIRECT_MALLOC)
915 # define MPROTECT_VDB
917 /* We seem to get random errors in incremental mode, */
918 /* possibly because Linux threads is itself a malloc client */
919 /* and can't deal with the signals. */
922 # define DYNAMIC_LOADING
923 # ifdef UNDEFINED /* includes ro data */
925 # define DATASTART ((ptr_t)((((word) (&_etext)) + 0xfff) & ~0xfff))
927 # include <features.h>
928 # if defined(__GLIBC__) && __GLIBC__ >= 2
929 # define LINUX_DATA_START
931 extern char **__environ;
932 # define DATASTART ((ptr_t)(&__environ))
933 /* hideous kludge: __environ is the first */
934 /* word in crt0.o, and delimits the start */
935 /* of the data segment, no matter which */
936 /* ld options were passed through. */
937 /* We could use _etext instead, but that */
938 /* would include .rodata, which may */
939 /* contain large read-only data tables */
940 /* that we'd rather not scan. */
943 # define DATAEND (&_end)
946 # define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
948 # ifdef USE_I686_PREFETCH
949 # define PREFETCH(x) \
950 __asm__ __volatile__ (" prefetchnta %0": : "m"(*(char *)(x)))
951 /* Empirically prefetcht0 is much more effective at reducing */
952 /* cache miss stalls for the targetted load instructions. But it */
953 /* seems to interfere enough with other cache traffic that the net */
954 /* result is worse than prefetchnta. */
956 /* Using prefetches for write seems to have a slight negative */
957 /* impact on performance, at least for a PIII/500. */
958 # define PREFETCH_FOR_WRITE(x) \
959 __asm__ __volatile__ (" prefetcht0 %0": : "m"(*(char *)(x)))
962 # ifdef USE_3DNOW_PREFETCH
963 # define PREFETCH(x) \
964 __asm__ __volatile__ (" prefetch %0": : "m"(*(char *)(x)))
965 # define PREFETCH_FOR_WRITE(x) \
966 __asm__ __volatile__ (" prefetchw %0": : "m"(*(char *)(x)))
970 # define OS_TYPE "CYGWIN32"
971 extern int _data_start__;
972 extern int _data_end__;
973 extern int _bss_start__;
974 extern int _bss_end__;
975 /* For binutils 2.9.1, we have */
976 /* DATASTART = _data_start__ */
977 /* DATAEND = _bss_end__ */
978 /* whereas for some earlier versions it was */
979 /* DATASTART = _bss_start__ */
980 /* DATAEND = _data_end__ */
981 /* To get it right for both, we take the */
982 /* minumum/maximum of the two. */
983 # define MAX(x,y) ((x) > (y) ? (x) : (y))
984 # define MIN(x,y) ((x) < (y) ? (x) : (y))
985 # define DATASTART ((ptr_t) MIN(&_data_start__, &_bss_start__))
986 # define DATAEND ((ptr_t) MAX(&_data_end__, &_bss_end__))
988 # define STACK_GRAN 0x10000
992 # define OS_TYPE "OS2"
993 /* STACKBOTTOM and DATASTART are handled specially in */
994 /* os_dep.c. OS2 actually has the right */
996 # define DATAEND /* not needed */
997 # define USE_GENERIC_PUSH_REGS
1000 # define OS_TYPE "MSWIN32"
1001 /* STACKBOTTOM and DATASTART are handled specially in */
1003 # ifndef __WATCOMC__
1004 # define MPROTECT_VDB
1006 # define DATAEND /* not needed */
1009 # define OS_TYPE "MSWINCE"
1010 # define DATAEND /* not needed */
1013 # define OS_TYPE "DJGPP"
1014 # include "stubinfo.h"
1017 extern int __djgpp_stack_limit;
1018 # define DATASTART ((ptr_t)((((word) (&etext)) + 0x1ff) & ~0x1ff))
1019 /* # define STACKBOTTOM ((ptr_t)((word) _stubinfo + _stubinfo->size \
1021 # define STACKBOTTOM ((ptr_t)((word) __djgpp_stack_limit + _stklen))
1022 /* This may not be right. */
1025 # define OS_TYPE "OPENBSD"
1028 # define OS_TYPE "FREEBSD"
1029 # ifndef GC_FREEBSD_THREADS
1030 # define MPROTECT_VDB
1032 # define SIG_SUSPEND SIGUSR1
1033 # define SIG_THR_RESTART SIGUSR2
1034 # define FREEBSD_STACKBOTTOM
1036 # define DYNAMIC_LOADING
1040 # define OS_TYPE "NETBSD"
1043 # define OS_TYPE "THREE86BSD"
1046 # define OS_TYPE "BSDI"
1048 # if defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) \
1049 || defined(THREE86BSD) || defined(BSDI)
1052 # define DATASTART ((ptr_t)(&etext))
1055 # define OS_TYPE "NEXT"
1056 # define DATASTART ((ptr_t) get_etext())
1057 # define STACKBOTTOM ((ptr_t)0xc0000000)
1058 # define DATAEND /* not needed */
1061 # define OS_TYPE "DOS4GW"
1062 extern long __nullarea;
1064 extern char *_STACKTOP;
1065 /* Depending on calling conventions Watcom C either precedes
1066 or does not precedes with undescore names of C-variables.
1067 Make sure startup code variables always have the same names. */
1068 #pragma aux __nullarea "*";
1069 #pragma aux _end "*";
1070 # define STACKBOTTOM ((ptr_t) _STACKTOP)
1071 /* confused? me too. */
1072 # define DATASTART ((ptr_t) &__nullarea)
1073 # define DATAEND ((ptr_t) &_end)
1076 # define OS_TYPE "HURD"
1077 # define STACK_GROWS_DOWN
1079 extern int __data_start;
1080 # define DATASTART ( (ptr_t) (&__data_start))
1082 # define DATAEND ( (ptr_t) (&_end))
1083 /* # define MPROTECT_VDB Not quite working yet? */
1084 # define DYNAMIC_LOADING
1089 # define MACH_TYPE "NS32K"
1090 # define ALIGNMENT 4
1091 extern char **environ;
1092 # define DATASTART ((ptr_t)(&environ))
1093 /* hideous kludge: environ is the first */
1094 /* word in crt0.o, and delimits the start */
1095 /* of the data segment, no matter which */
1096 /* ld options were passed through. */
1097 # define STACKBOTTOM ((ptr_t) 0xfffff000) /* for Encore */
1101 # define MACH_TYPE "MIPS"
1103 /* This was developed for a linuxce style platform. Probably */
1104 /* needs to be tweaked for workstation class machines. */
1105 # define OS_TYPE "LINUX"
1106 extern int __data_start;
1107 # define DATASTART ((ptr_t)(&__data_start))
1108 # define ALIGNMENT 4
1109 # define USE_GENERIC_PUSH_REGS
1110 # define STACKBOTTOM ((ptr_t)0x7fff8000)
1111 /* Older toolchains may need 0x80000000. */
1112 /* In many cases, this should probably use LINUX_STACKBOTTOM */
1113 /* instead. But some kernel versions seem to give the wrong */
1114 /* value from /proc. */
1118 # define DATASTART (ptr_t)0x10000000
1119 /* Could probably be slightly higher since */
1120 /* startup code allocates lots of stuff. */
1121 # define OS_TYPE "ULTRIX"
1122 # define ALIGNMENT 4
1126 # define DATASTART (ptr_t)0x10000000
1127 # define OS_TYPE "RISCOS"
1128 # define ALIGNMENT 4 /* Required by hardware */
1133 # define DATASTART ((ptr_t)(&_fdata))
1135 # define HEAP_START (ptr_t)0x30000000
1137 # define HEAP_START DATASTART
1139 /* Lowest plausible heap address. */
1140 /* In the MMAP case, we map there. */
1141 /* In either case it is used to identify */
1142 /* heap sections so they're not */
1143 /* considered as roots. */
1144 # define OS_TYPE "IRIX5"
1145 # define MPROTECT_VDB
1147 # define CPP_WORDSZ _MIPS_SZPTR
1148 # define ALIGNMENT (_MIPS_SZPTR/8)
1149 # if CPP_WORDSZ != 64
1150 # define ALIGN_DOUBLE
1153 # define ALIGNMENT 4
1154 # define ALIGN_DOUBLE
1156 # define DYNAMIC_LOADING
1159 # define OS_TYPE "MSWINCE"
1160 # define ALIGNMENT 4
1161 # define DATAEND /* not needed */
1163 # if defined(NETBSD)
1164 /* This also checked for __MIPSEL__ . Why? NETBSD recognition */
1165 /* should be handled at the top of the file. */
1166 # define ALIGNMENT 4
1167 # define OS_TYPE "NETBSD"
1169 # define USE_GENERIC_PUSH_REGS
1172 # define DATASTART GC_data_start
1173 # define NEED_FIND_LIMIT
1174 # define DYNAMIC_LOADING
1176 # define DATASTART ((ptr_t) 0x10000000)
1177 # define STACKBOTTOM ((ptr_t) 0x7ffff000)
1183 # define MACH_TYPE "RS6000"
1185 # define ALIGNMENT 8
1186 # define CPP_WORDSZ 64
1188 # define ALIGNMENT 4
1189 # define CPP_WORDSZ 32
1191 extern int _data, _end;
1192 # define DATASTART ((ptr_t)((ulong)&_data))
1193 # define DATAEND ((ptr_t)((ulong)&_end))
1195 # define STACKBOTTOM ((ptr_t)((ulong)&errno))
1196 # define USE_GENERIC_PUSH_REGS
1197 # define DYNAMIC_LOADING
1198 /* For really old versions of AIX, this may have to be removed. */
1202 # define MACH_TYPE "HP_PA"
1204 # define CPP_WORDSZ 64
1205 # define ALIGNMENT 8
1207 # define CPP_WORDSZ 32
1208 # define ALIGNMENT 4
1209 # define ALIGN_DOUBLE
1211 # if !defined(GC_HPUX_THREADS) && !defined(GC_LINUX_THREADS)
1212 # ifndef LINUX /* For now. */
1213 # define MPROTECT_VDB
1216 # define GENERIC_COMPARE_AND_SWAP
1217 /* No compare-and-swap instruction. Use pthread mutexes */
1218 /* when we absolutely have to. */
1219 # ifdef PARALLEL_MARK
1220 # define USE_MARK_BYTES
1221 /* Minimize compare-and-swap usage. */
1224 # define STACK_GROWS_UP
1226 # define OS_TYPE "HPUX"
1227 extern int __data_start;
1228 # define DATASTART ((ptr_t)(&__data_start))
1230 /* The following appears to work for 7xx systems running HP/UX */
1231 /* 9.xx Furthermore, it might result in much faster */
1232 /* collections than HEURISTIC2, which may involve scanning */
1233 /* segments that directly precede the stack. It is not the */
1234 /* default, since it may not work on older machine/OS */
1235 /* combinations. (Thanks to Raymond X.T. Nijssen for uncovering */
1237 # define STACKBOTTOM ((ptr_t) 0x7b033000) /* from /etc/conf/h/param.h */
1239 /* Gustavo Rodriguez-Rivera suggested changing HEURISTIC2 */
1240 /* to this. Note that the GC must be initialized before the */
1241 /* first putenv call. */
1242 extern char ** environ;
1243 # define STACKBOTTOM ((ptr_t)environ)
1245 # define DYNAMIC_LOADING
1246 # include <unistd.h>
1247 # define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
1249 # define PREFETCH(x) { \
1250 register long addr = (long)(x); \
1251 (void) _asm ("LDW", 0, 0, addr, 0); \
1256 # define OS_TYPE "LINUX"
1257 # define LINUX_STACKBOTTOM
1258 # define DYNAMIC_LOADING
1259 # define LINUX_DATA_START
1261 # define DATAEND (&_end)
1266 # define MACH_TYPE "ALPHA"
1267 # define ALIGNMENT 8
1269 # define OS_TYPE "NETBSD"
1271 # define DATASTART GC_data_start
1272 # define ELFCLASS32 32
1273 # define ELFCLASS64 64
1274 # define ELF_CLASS ELFCLASS64
1275 # define CPP_WORDSZ 64
1276 # define DYNAMIC_LOADING
1279 # define OS_TYPE "OPENBSD"
1281 # define CPP_WORDSZ 64
1282 # ifdef __ELF__ /* since OpenBSD/Alpha 2.9 */
1283 # define DATASTART GC_data_start
1284 # define ELFCLASS32 32
1285 # define ELFCLASS64 64
1286 # define ELF_CLASS ELFCLASS64
1287 # else /* ECOFF, until OpenBSD/Alpha 2.7 */
1288 # define DATASTART ((ptr_t) 0x140000000)
1292 # define OS_TYPE "OSF1"
1293 # define DATASTART ((ptr_t) 0x140000000)
1295 # define DATAEND ((ptr_t) &_end)
1296 extern char ** environ;
1297 /* round up from the value of environ to the nearest page boundary */
1298 /* Probably breaks if putenv is called before collector */
1299 /* initialization. */
1300 # define STACKBOTTOM ((ptr_t)(((word)(environ) | (getpagesize()-1))+1))
1301 /* # define HEURISTIC2 */
1302 /* Normally HEURISTIC2 is too conervative, since */
1303 /* the text segment immediately follows the stack. */
1304 /* Hence we give an upper pound. */
1305 /* This is currently unused, since we disabled HEURISTIC2 */
1307 # define HEURISTIC2_LIMIT ((ptr_t)((word)(&__start) & ~(getpagesize()-1)))
1308 # define CPP_WORDSZ 64
1309 # define MPROTECT_VDB
1310 # define DYNAMIC_LOADING
1313 # define OS_TYPE "LINUX"
1314 # define CPP_WORDSZ 64
1315 # define STACKBOTTOM ((ptr_t) 0x120000000)
1317 # define SEARCH_FOR_DATA_START
1318 # define DATASTART GC_data_start
1319 # define DYNAMIC_LOADING
1321 # define DATASTART ((ptr_t) 0x140000000)
1324 # define DATAEND (&_end)
1325 # define MPROTECT_VDB
1326 /* Has only been superficially tested. May not */
1327 /* work on all versions. */
1332 # define MACH_TYPE "IA64"
1333 # define USE_GENERIC_PUSH_REGS
1334 /* We need to get preserved registers in addition to register */
1335 /* windows. That's easiest to do with setjmp. */
1336 # ifdef PARALLEL_MARK
1337 # define USE_MARK_BYTES
1338 /* Compare-and-exchange is too expensive to use for */
1339 /* setting mark bits. */
1343 # define CPP_WORDSZ 32
1344 # define ALIGN_DOUBLE
1345 /* Requires 8 byte alignment for malloc */
1346 # define ALIGNMENT 4
1351 # define CPP_WORDSZ 64
1352 # define ALIGN_DOUBLE
1353 /* Requires 16 byte alignment for malloc */
1354 # define ALIGNMENT 8
1356 # define OS_TYPE "HPUX"
1357 extern int __data_start;
1358 # define DATASTART ((ptr_t)(&__data_start))
1359 /* Gustavo Rodriguez-Rivera suggested changing HEURISTIC2 */
1360 /* to this. Note that the GC must be initialized before the */
1361 /* first putenv call. */
1362 extern char ** environ;
1363 # define STACKBOTTOM ((ptr_t)environ)
1364 # define DYNAMIC_LOADING
1365 # include <unistd.h>
1366 # define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
1367 /* The following was empirically determined, and is probably */
1368 /* not very robust. */
1369 /* Note that the backing store base seems to be at a nice */
1370 /* address minus one page. */
1371 # define BACKING_STORE_DISPLACEMENT 0x1000000
1372 # define BACKING_STORE_ALIGNMENT 0x1000
1373 # define BACKING_STORE_BASE \
1374 (ptr_t)(((word)GC_stackbottom - BACKING_STORE_DISPLACEMENT - 1) \
1375 & ~(BACKING_STORE_ALIGNMENT - 1))
1378 # define CPP_WORDSZ 64
1379 # define ALIGN_DOUBLE
1380 /* Requires 16 byte alignment for malloc */
1381 # define ALIGNMENT 8
1382 # define OS_TYPE "LINUX"
1383 /* The following works on NUE and older kernels: */
1384 /* # define STACKBOTTOM ((ptr_t) 0xa000000000000000l) */
1385 /* This does not work on NUE: */
1386 # define LINUX_STACKBOTTOM
1387 /* We also need the base address of the register stack */
1388 /* backing store. This is computed in */
1389 /* GC_linux_register_stack_base based on the following */
1391 # define BACKING_STORE_ALIGNMENT 0x100000
1392 # define BACKING_STORE_DISPLACEMENT 0x80000000
1393 extern char * GC_register_stackbottom;
1394 # define BACKING_STORE_BASE ((ptr_t)GC_register_stackbottom)
1395 # define SEARCH_FOR_DATA_START
1396 # define DATASTART GC_data_start
1397 # define DYNAMIC_LOADING
1398 # define MPROTECT_VDB
1399 /* Requires Linux 2.3.47 or later. */
1401 # define DATAEND (&_end)
1403 # define PREFETCH(x) \
1404 __asm__ (" lfetch [%0]": : "r"((void *)(x)))
1405 # define PREFETCH_FOR_WRITE(x) \
1406 __asm__ (" lfetch.excl [%0]": : "r"((void *)(x)))
1407 # define CLEAR_DOUBLE(x) \
1408 __asm__ (" stf.spill [%0]=f0": : "r"((void *)(x)))
1414 # define MACH_TYPE "M88K"
1415 # define ALIGNMENT 4
1416 # define ALIGN_DOUBLE
1419 # define OS_TYPE "CX_UX"
1420 # define DATASTART ((((word)&etext + 0x3fffff) & ~0x3fffff) + 0x10000)
1423 # define OS_TYPE "DGUX"
1424 extern char * GC_SysVGetDataStart();
1425 # define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &etext)
1427 # define STACKBOTTOM ((char*)0xf0000000) /* determined empirically */
1431 # define MACH_TYPE "S370"
1432 # define ALIGNMENT 4 /* Required by hardware */
1433 # define USE_GENERIC_PUSH_REGS
1435 # define OS_TYPE "UTS4"
1439 extern char * GC_SysVGetDataStart();
1440 # define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
1441 # define DATAEND (&_end)
1445 # define OS_TYPE "LINUX"
1447 # define DYNAMIC_LOADING
1448 extern int __data_start;
1449 # define DATASTART ((ptr_t)(&__data_start))
1454 # define ALIGNMENT 4
1456 # define DATASTART ((ptr_t)(&_etext))
1461 # define CPP_WORDSZ 32
1462 # define MACH_TYPE "ARM32"
1463 # define ALIGNMENT 4
1465 # define OS_TYPE "NETBSD"
1468 # define DATASTART ((ptr_t)(&etext))
1469 # define USE_GENERIC_PUSH_REGS
1472 # define OS_TYPE "LINUX"
1475 # define STACK_GRAN 0x10000000
1476 # define USE_GENERIC_PUSH_REGS
1478 # define DYNAMIC_LOADING
1479 # include <features.h>
1480 # if defined(__GLIBC__) && __GLIBC__ >= 2
1481 # define LINUX_DATA_START
1483 extern char **__environ;
1484 # define DATASTART ((ptr_t)(&__environ))
1485 /* hideous kludge: __environ is the first */
1486 /* word in crt0.o, and delimits the start */
1487 /* of the data segment, no matter which */
1488 /* ld options were passed through. */
1489 /* We could use _etext instead, but that */
1490 /* would include .rodata, which may */
1491 /* contain large read-only data tables */
1492 /* that we'd rather not scan. */
1495 # define DATAEND (&_end)
1498 # define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
1502 # define OS_TYPE "MSWINCE"
1503 # define DATAEND /* not needed */
1506 /* __data_start is usually defined in the target linker script. */
1507 extern int __data_start;
1508 # define DATASTART (ptr_t)(&__data_start)
1509 # define USE_GENERIC_PUSH_REGS
1510 /* __stack_base__ is set in newlib/libc/sys/arm/crt0.S */
1511 extern void *__stack_base__;
1512 # define STACKBOTTOM ((ptr_t) (__stack_base__))
1517 # define MACH_TYPE "SH"
1518 # define ALIGNMENT 4
1520 # define OS_TYPE "MSWINCE"
1521 # define DATAEND /* not needed */
1524 # define OS_TYPE "LINUX"
1525 # define STACKBOTTOM ((ptr_t) 0x7c000000)
1526 # define USE_GENERIC_PUSH_REGS
1527 # define DYNAMIC_LOADING
1528 # define LINUX_DATA_START
1530 # define DATAEND (&_end)
1535 # define MACH_TYPE "SH4"
1536 # define OS_TYPE "MSWINCE"
1537 # define ALIGNMENT 4
1538 # define DATAEND /* not needed */
1541 #ifdef LINUX_DATA_START
1542 /* Some Linux distributions arrange to define __data_start. Some */
1543 /* define data_start as a weak symbol. The latter is technically */
1544 /* broken, since the user program may define data_start, in which */
1545 /* case we lose. Nonetheless, we try both, prefering __data_start. */
1546 /* We assume gcc. */
1547 # pragma weak __data_start
1548 extern int __data_start;
1549 # pragma weak data_start
1550 extern int data_start;
1551 # define DATASTART ((ptr_t)(&__data_start != 0? &__data_start : &data_start))
1554 #if defined(LINUX) && defined(REDIRECT_MALLOC)
1555 /* Rld appears to allocate some memory with its own allocator, and */
1556 /* some through malloc, which might be redirected. To make this */
1557 /* work with collectable memory, we have to scan memory allocated */
1558 /* by rld's internal malloc. */
1559 # define USE_PROC_FOR_LIBRARIES
1562 # ifndef STACK_GROWS_UP
1563 # define STACK_GROWS_DOWN
1567 # define CPP_WORDSZ 32
1576 # define DATAEND (&end)
1579 # if defined(SVR4) && !defined(GETPAGESIZE)
1580 # include <unistd.h>
1581 # define GETPAGESIZE() sysconf(_SC_PAGESIZE)
1584 # ifndef GETPAGESIZE
1585 # if defined(SUNOS5) || defined(IRIX5)
1586 # include <unistd.h>
1588 # define GETPAGESIZE() getpagesize()
1591 # if defined(SUNOS5) || defined(DRSNX) || defined(UTS4)
1592 /* OS has SVR4 generic features. Probably others also qualify. */
1596 # if defined(SUNOS5) || defined(DRSNX)
1597 /* OS has SUNOS5 style semi-undocumented interface to dynamic */
1600 /* OS has SUNOS5 style signal handlers. */
1608 # if defined(SVR4) || defined(LINUX) || defined(IRIX) || defined(HPUX) \
1609 || defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) \
1610 || defined(BSD) || defined(_AIX) || defined(MACOSX) || defined(OSF1)
1611 # define UNIX_LIKE /* Basic Unix-like system calls work. */
1614 # if CPP_WORDSZ != 32 && CPP_WORDSZ != 64
1619 # undef DYNAMIC_LOADING
1624 # undef MPROTECT_VDB
1629 /* Postponed for now. */
1631 # undef MPROTECT_VDB
1634 # ifdef SMALL_CONFIG
1635 /* Presumably not worth the space it takes. */
1637 # undef MPROTECT_VDB
1641 # undef MPROTECT_VDB /* Can't deal with address space holes. */
1644 # ifdef PARALLEL_MARK
1645 # undef MPROTECT_VDB /* For now. */
1648 # if !defined(PCR_VDB) && !defined(PROC_VDB) && !defined(MPROTECT_VDB)
1649 # define DEFAULT_VDB
1653 # define PREFETCH(x)
1654 # define NO_PREFETCH
1657 # ifndef PREFETCH_FOR_WRITE
1658 # define PREFETCH_FOR_WRITE(x)
1659 # define NO_PREFETCH_FOR_WRITE
1662 # ifndef CACHE_LINE_SIZE
1663 # define CACHE_LINE_SIZE 32 /* Wild guess */
1666 # ifndef CLEAR_DOUBLE
1667 # define CLEAR_DOUBLE(x) \
1668 ((word*)x)[0] = 0; \
1670 # endif /* CLEAR_DOUBLE */
1672 /* Internally we use GC_SOLARIS_THREADS to test for either old or pthreads. */
1673 # if defined(GC_SOLARIS_PTHREADS) && !defined(GC_SOLARIS_THREADS)
1674 # define GC_SOLARIS_THREADS
1677 # if defined(GC_IRIX_THREADS) && !defined(IRIX5)
1678 --> inconsistent configuration
1680 # if defined(GC_LINUX_THREADS) && !defined(LINUX)
1681 --> inconsistent configuration
1683 # if defined(GC_SOLARIS_THREADS) && !defined(SUNOS5)
1684 --> inconsistent configuration
1686 # if defined(GC_HPUX_THREADS) && !defined(HPUX)
1687 --> inconsistent configuration
1689 # if defined(GC_WIN32_THREADS) && !defined(MSWIN32)
1690 /* Ideally CYGWIN32 should work, in addition to MSWIN32. I suspect */
1691 /* the necessary code is mostly there, but nobody has actually made */
1692 /* sure the right combination of pieces is compiled in, etc. */
1693 --> inconsistent configuration
1696 # if defined(PCR) || defined(SRC_M3) || \
1697 defined(GC_SOLARIS_THREADS) || defined(GC_WIN32_THREADS) || \
1698 defined(GC_PTHREADS)
1702 # if defined(HP_PA) || defined(M88K) || defined(POWERPC) && !defined(MACOSX) \
1703 || defined(LINT) || defined(MSWINCE) \
1704 || (defined(I386) && defined(__LCC__))
1705 /* Use setjmp based hack to mark from callee-save registers. */
1706 /* The define should move to the individual platform */
1708 # define USE_GENERIC_PUSH_REGS
1710 # if defined(I386) && defined(LINUX)
1711 /* SAVE_CALL_CHAIN is supported if the code is compiled to save */
1712 /* frame pointers by default, i.e. no -fomit-frame-pointer flag. */
1713 # ifdef SAVE_CALL_COUNT
1714 # define SAVE_CALL_CHAIN
1718 # define SAVE_CALL_CHAIN
1719 # define ASM_CLEAR_CODE /* Stack clearing is crucial, and we */
1720 /* include assembly code to do it well. */
1723 # endif /* GCCONFIG_H */