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(sun) && defined(mc68000)
45 # define mach_type_known
47 # if defined(hp9000s300)
50 # define mach_type_known
52 # if defined(OPENBSD) && defined(m68k)
54 # define mach_type_known
56 # if defined(OPENBSD) && defined(__sparc__)
58 # define mach_type_known
60 # if defined(NETBSD) && defined(m68k)
62 # define mach_type_known
64 # if defined(NETBSD) && defined(__powerpc__)
66 # define mach_type_known
68 # if defined(NETBSD) && defined(__arm32__)
70 # define mach_type_known
79 # define mach_type_known
81 # if defined(mips) || defined(__mips)
84 # if defined(ultrix) || defined(__ultrix) || defined(__NetBSD__)
87 # if defined(_SYSTYPE_SVR4) || defined(SYSTYPE_SVR4) \
88 || defined(__SYSTYPE_SVR4__)
89 # define IRIX5 /* or IRIX 6.X */
91 # define RISCOS /* or IRIX 4.X */
95 # if defined(__NetBSD__) && defined(__MIPSEL__)
98 # define mach_type_known
100 # if defined(sequent) && (defined(i386) || defined(__i386__))
103 # define mach_type_known
105 # if defined(sun) && (defined(i386) || defined(__i386__))
108 # define mach_type_known
110 # if (defined(__OS2__) || defined(__EMX__)) && defined(__32BIT__)
113 # define mach_type_known
117 # define mach_type_known
119 # if defined(sun) && (defined(sparc) || defined(__sparc))
121 /* Test for SunOS 5.x */
128 # define mach_type_known
130 # if defined(sparc) && defined(unix) && !defined(sun) && !defined(linux) \
131 && !defined(__OpenBSD__) && !(__NetBSD__)
134 # define mach_type_known
138 # define mach_type_known
140 # if defined(__NetBSD__) && defined(__sparc__)
142 # define mach_type_known
144 # if defined(_M_XENIX) && defined(_M_SYSV) && defined(_M_I386)
145 /* The above test may need refinement */
147 # if defined(_SCO_ELF)
152 # define mach_type_known
154 # if defined(_AUX_SOURCE)
157 # define mach_type_known
159 # if defined(_PA_RISC1_0) || defined(_PA_RISC1_1) || defined(_PA_RISC2_0) \
160 || defined(hppa) || defined(__hppa__)
165 # define mach_type_known
167 # if defined(__ia64) && defined(_HPUX_SOURCE)
170 # define mach_type_known
172 # if defined(__BEOS__) && defined(_X86_)
175 # define mach_type_known
177 # if defined(LINUX) && (defined(i386) || defined(__i386__))
179 # define mach_type_known
181 # if defined(LINUX) && (defined(__ia64__) || defined(__ia64))
183 # define mach_type_known
185 # if defined(LINUX) && (defined(powerpc) || defined(__powerpc__))
187 # define mach_type_known
189 # if defined(LINUX) && defined(__mc68000__)
191 # define mach_type_known
193 # if defined(LINUX) && (defined(sparc) || defined(__sparc__))
195 # define mach_type_known
197 # if defined(LINUX) && defined(__arm__)
199 # define mach_type_known
201 # if defined(LINUX) && defined(__sh__)
203 # define mach_type_known
205 # if defined(__alpha) || defined(__alpha__)
207 # if !defined(LINUX) && !defined(NETBSD) && !defined(OPENBSD)
208 # define OSF1 /* a.k.a Digital Unix */
210 # define mach_type_known
212 # if defined(_AMIGA) && !defined(AMIGA)
217 # define mach_type_known
219 # if defined(THINK_C) || defined(__MWERKS__) && !defined(__powerc)
222 # define mach_type_known
224 # if defined(__MWERKS__) && defined(__powerc)
227 # define mach_type_known
229 # if defined(macosx) || \
230 defined(__APPLE__) && defined(__MACH__) && defined(__ppc__)
233 # define mach_type_known
235 # if defined(__APPLE__) && defined(__MACH__) && defined(__i386__)
238 --> Not really supported, but at least we recognize it.
240 # if defined(NeXT) && defined(mc68000)
243 # define mach_type_known
245 # if defined(NeXT) && (defined(i386) || defined(__i386__))
248 # define mach_type_known
250 # if defined(__OpenBSD__) && (defined(i386) || defined(__i386__))
253 # define mach_type_known
255 # if defined(__FreeBSD__) && (defined(i386) || defined(__i386__))
258 # define mach_type_known
260 # if defined(__NetBSD__) && (defined(i386) || defined(__i386__))
262 # define mach_type_known
264 # if defined(bsdi) && (defined(i386) || defined(__i386__))
267 # define mach_type_known
269 # if !defined(mach_type_known) && defined(__386BSD__)
272 # define mach_type_known
274 # if defined(_CX_UX) && defined(_M88K)
277 # define mach_type_known
282 # define mach_type_known
284 # if defined(_WIN32_WCE)
285 /* SH3, SH4, MIPS already defined for corresponding architectures */
286 # if defined(SH3) || defined(SH4)
296 # define mach_type_known
298 # if (defined(_MSDOS) || defined(_MSC_VER)) && (_M_IX86 >= 300) \
299 || defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__)
301 # define MSWIN32 /* or Win32s */
302 # define mach_type_known
305 # if defined(__DJGPP__)
308 # define DJGPP /* MSDOS running the DJGPP port of GCC */
310 # define mach_type_known
312 # if defined(__CYGWIN32__) || defined(__CYGWIN__)
315 # define mach_type_known
317 # if defined(__MINGW32__)
320 # define mach_type_known
322 # if defined(__BORLANDC__)
325 # define mach_type_known
327 # if defined(_UTS) && !defined(mach_type_known)
330 # define mach_type_known
334 # define mach_type_known
336 # if defined(__embedded__) && defined(PPC)
339 # define mach_type_known
342 # if defined(__WATCOMC__) && defined(__386__)
344 # if !defined(OS2) && !defined(MSWIN32) && !defined(DOS4GW)
345 # if defined(__OS2__)
348 # if defined(__WINDOWS_386__) || defined(__NT__)
355 # define mach_type_known
357 # if defined(__s390__) && defined(LINUX)
359 # define mach_type_known
361 # if defined(__GNU__)
362 # if defined(__i386__)
363 /* The Debian Hurd running on generic PC */
366 # define mach_type_known
370 /* Feel free to add more clauses here */
372 /* Or manually define the machine type here. A machine type is */
373 /* characterized by the architecture. Some */
374 /* machine types are further subdivided by OS. */
375 /* the macros ULTRIX, RISCOS, and BSD to distinguish. */
376 /* Note that SGI IRIX is treated identically to RISCOS. */
377 /* SYSV on an M68K actually means A/UX. */
378 /* The distinction in these cases is usually the stack starting address */
379 # ifndef mach_type_known
380 --> unknown machine type
382 /* Mapping is: M68K ==> Motorola 680X0 */
383 /* (SUNOS4,HP,NEXT, and SYSV (A/UX), */
384 /* MACOS and AMIGA variants) */
385 /* I386 ==> Intel 386 */
386 /* (SEQUENT, OS2, SCO, LINUX, NETBSD, */
387 /* FREEBSD, THREE86BSD, MSWIN32, */
388 /* BSDI,SUNOS5, NEXT, other variants) */
389 /* NS32K ==> Encore Multimax */
390 /* MIPS ==> R2000 or R3000 */
391 /* (RISCOS, ULTRIX variants) */
392 /* VAX ==> DEC VAX */
393 /* (BSD, ULTRIX variants) */
394 /* RS6000 ==> IBM RS/6000 AIX3.X */
395 /* RT ==> IBM PC/RT */
396 /* HP_PA ==> HP9000/700 & /800 */
398 /* SPARC ==> SPARC v7/v8/v9 */
399 /* (SUNOS4, SUNOS5, LINUX, */
400 /* DRSNX variants) */
401 /* ALPHA ==> DEC Alpha */
402 /* (OSF1 and LINUX variants) */
403 /* M88K ==> Motorola 88XX0 */
404 /* (CX_UX and DGUX) */
405 /* S370 ==> 370-like machine */
406 /* running Amdahl UTS4 */
407 /* or a 390 running LINUX */
408 /* ARM32 ==> Intel StrongARM */
409 /* IA64 ==> Intel IPF */
411 /* (LINUX and HPUX) */
412 /* IA64_32 ==> IA64 w/32 bit ABI */
414 /* SH ==> Hitachi SuperH */
415 /* (LINUX & MSWINCE) */
419 * For each architecture and OS, the following need to be defined:
421 * CPP_WORD_SZ is a simple integer constant representing the word size.
422 * in bits. We assume byte addressibility, where a byte has 8 bits.
423 * We also assume CPP_WORD_SZ is either 32 or 64.
424 * (We care about the length of pointers, not hardware
425 * bus widths. Thus a 64 bit processor with a C compiler that uses
426 * 32 bit pointers should use CPP_WORD_SZ of 32, not 64. Default is 32.)
428 * MACH_TYPE is a string representation of the machine type.
429 * OS_TYPE is analogous for the OS.
431 * ALIGNMENT is the largest N, such that
432 * all pointer are guaranteed to be aligned on N byte boundaries.
433 * defining it to be 1 will always work, but perform poorly.
435 * DATASTART is the beginning of the data segment.
436 * On UNIX systems, the collector will scan the area between DATASTART
437 * and DATAEND for root pointers.
439 * DATAEND, if not &end.
441 * ALIGN_DOUBLE of GC_malloc should return blocks aligned to twice
444 * STACKBOTTOM is the cool end of the stack, which is usually the
445 * highest address in the stack.
446 * Under PCR or OS/2, we have other ways of finding thread stacks.
447 * For each machine, the following should:
448 * 1) define STACK_GROWS_UP if the stack grows toward higher addresses, and
449 * 2) define exactly one of
450 * STACKBOTTOM (should be defined to be an expression)
453 * If either of the last two macros are defined, then STACKBOTTOM is computed
454 * during collector startup using one of the following two heuristics:
455 * HEURISTIC1: Take an address inside GC_init's frame, and round it up to
456 * the next multiple of STACK_GRAN.
457 * HEURISTIC2: Take an address inside GC_init's frame, increment it repeatedly
458 * in small steps (decrement if STACK_GROWS_UP), and read the value
459 * at each location. Remember the value when the first
460 * Segmentation violation or Bus error is signalled. Round that
461 * to the nearest plausible page boundary, and use that instead
464 * Gustavo Rodriguez-Rivera points out that on most (all?) Unix machines,
465 * the value of environ is a pointer that can serve as STACKBOTTOM.
466 * I expect that HEURISTIC2 can be replaced by this approach, which
467 * interferes far less with debugging. However it has the disadvantage
468 * that it's confused by a putenv call before the collector is initialized.
469 * This could be dealt with by intercepting putenv ...
471 * If no expression for STACKBOTTOM can be found, and neither of the above
472 * heuristics are usable, the collector can still be used with all of the above
473 * undefined, provided one of the following is done:
474 * 1) GC_mark_roots can be changed to somehow mark from the correct stack(s)
475 * without reference to STACKBOTTOM. This is appropriate for use in
476 * conjunction with thread packages, since there will be multiple stacks.
477 * (Allocating thread stacks in the heap, and treating them as ordinary
478 * heap data objects is also possible as a last resort. However, this is
479 * likely to introduce significant amounts of excess storage retention
480 * unless the dead parts of the thread stacks are periodically cleared.)
481 * 2) Client code may set GC_stackbottom before calling any GC_ routines.
482 * If the author of the client code controls the main program, this is
483 * easily accomplished by introducing a new main program, setting
484 * GC_stackbottom to the address of a local variable, and then calling
485 * the original main program. The new main program would read something
488 * # include "gc_private.h"
490 * main(argc, argv, envp)
492 * char **argv, **envp;
496 * GC_stackbottom = (ptr_t)(&dummy);
497 * return(real_main(argc, argv, envp));
501 * Each architecture may also define the style of virtual dirty bit
502 * implementation to be used:
503 * MPROTECT_VDB: Write protect the heap and catch faults.
504 * PROC_VDB: Use the SVR4 /proc primitives to read dirty bits.
506 * An architecture may define DYNAMIC_LOADING if dynamic_load.c
507 * defined GC_register_dynamic_libraries() for the architecture.
509 * An architecture may define PREFETCH(x) to preload the cache with *x.
510 * This defaults to a no-op.
512 * PREFETCH_FOR_WRITE(x) is used if *x is about to be written.
514 * An architecture may also define CLEAR_DOUBLE(x) to be a fast way to
515 * clear the two words at GC_malloc-aligned address x. By default,
516 * word stores of 0 are used instead.
519 /* If we are using a recent version of gcc, we can use __builtin_unwind_init()
520 * to push the relevant registers onto the stack. This generally makes
521 * USE_GENERIC_PUSH_REGS the preferred approach for marking from registers.
523 # if defined(__GNUC__) && ((__GNUC__ >= 3) || \
524 (__GNUC__ == 2 && __GNUC_MINOR__ >= 8))
525 # define HAVE_BUILTIN_UNWIND_INIT
528 # define STACK_GRAN 0x1000000
530 # define MACH_TYPE "M68K"
533 # define OS_TYPE "OPENBSD"
536 # define DATASTART ((ptr_t)(&etext))
539 # define OS_TYPE "NETBSD"
542 # define DATASTART ((ptr_t)(&etext))
545 # define OS_TYPE "LINUX"
546 # define STACKBOTTOM ((ptr_t)0xf0000000)
547 /* # define MPROTECT_VDB - Reported to not work 9/17/01 */
549 # define DYNAMIC_LOADING
550 # include <features.h>
551 # if defined(__GLIBC__)&& __GLIBC__>=2
552 # define LINUX_DATA_START
554 extern char **__environ;
555 # define DATASTART ((ptr_t)(&__environ))
556 /* hideous kludge: __environ is the first */
557 /* word in crt0.o, and delimits the start */
558 /* of the data segment, no matter which */
559 /* ld options were passed through. */
560 /* We could use _etext instead, but that */
561 /* would include .rodata, which may */
562 /* contain large read-only data tables */
563 /* that we'd rather not scan. */
564 # endif /* !GLIBC2 */
566 # define DATAEND (&_end)
569 # define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
573 # define OS_TYPE "SUNOS4"
575 # define DATASTART ((ptr_t)((((word) (&etext)) + 0x1ffff) & ~0x1ffff))
576 # define HEURISTIC1 /* differs */
577 # define DYNAMIC_LOADING
580 # define OS_TYPE "HP"
582 # define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
583 # define STACKBOTTOM ((ptr_t) 0xffeffffc)
584 /* empirically determined. seems to work. */
586 # define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
589 # define OS_TYPE "SYSV"
591 # define DATASTART ((ptr_t)((((word) (&etext)) + 0x3fffff) \
593 +((word)&etext & 0x1fff))
594 /* This only works for shared-text binaries with magic number 0413.
595 The other sorts of SysV binaries put the data at the end of the text,
596 in which case the default of &etext would work. Unfortunately,
597 handling both would require having the magic-number available.
600 # define STACKBOTTOM ((ptr_t)0xFFFFFFFE)
601 /* The stack starts at the top of memory, but */
602 /* 0x0 cannot be used as setjump_test complains */
603 /* that the stack direction is incorrect. Two */
604 /* bytes down from 0x0 should be safe enough. */
606 # include <sys/mmu.h>
607 # define GETPAGESIZE() PAGESIZE /* Is this still right? */
610 # define OS_TYPE "AMIGA"
611 /* STACKBOTTOM and DATASTART handled specially */
613 # define DATAEND /* not needed */
614 # define GETPAGESIZE() 4096
620 # define OS_TYPE "MACOS"
621 /* see os_dep.c for details of global data segments. */
622 # define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
623 # define DATAEND /* not needed */
624 # define GETPAGESIZE() 4096
627 # define OS_TYPE "NEXT"
628 # define DATASTART ((ptr_t) get_etext())
629 # define STACKBOTTOM ((ptr_t) 0x4000000)
630 # define DATAEND /* not needed */
635 # define MACH_TYPE "POWERPC"
637 # define ALIGNMENT 2 /* Still necessary? Could it be 4? */
641 # define OS_TYPE "MACOS"
642 /* see os_dep.c for details of global data segments. */
643 # define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
644 # define DATAEND /* not needed */
647 # define ALIGNMENT 4 /* Guess. Can someone verify? */
648 /* This was 2, but that didn't sound right. */
649 # define OS_TYPE "LINUX"
651 # define DYNAMIC_LOADING
653 # define STACK_GRAN 0x10000000
654 /* Stack usually starts at 0x80000000 */
655 # define LINUX_DATA_START
657 # define DATAEND (&_end)
660 /* There are reasons to suspect this may not be reliable. */
662 # define OS_TYPE "MACOSX"
663 # define DATASTART ((ptr_t) get_etext())
664 # define STACKBOTTOM ((ptr_t) 0xc0000000)
665 # define DATAEND /* not needed */
666 # define MPROTECT_VDB
668 # define GETPAGESIZE() getpagesize()
672 # define OS_TYPE "NETBSD"
675 # define DATASTART GC_data_start
676 # define DYNAMIC_LOADING
680 # define OS_TYPE "NOSYS"
681 extern void __end, __dso_handle;
682 # define DATASTART (&__dso_handle) /* OK, that's ugly. */
683 # define DATAEND (&__end)
684 /* Stack starts at 0xE0000000 for the simulator. */
686 # define STACK_GRAN 0x10000000
692 # define MACH_TYPE "VAX"
693 # define ALIGNMENT 4 /* Pointers are longword aligned by 4.2 C compiler */
695 # define DATASTART ((ptr_t)(&etext))
697 # define OS_TYPE "BSD"
699 /* HEURISTIC2 may be OK, but it's hard to test. */
702 # define OS_TYPE "ULTRIX"
703 # define STACKBOTTOM ((ptr_t) 0x7fffc800)
708 # define MACH_TYPE "RT"
710 # define DATASTART ((ptr_t) 0x10000000)
711 # define STACKBOTTOM ((ptr_t) 0x1fffd800)
715 # define MACH_TYPE "SPARC"
716 # if defined(__arch64__) || defined(__sparcv9)
718 # define CPP_WORDSZ 64
719 # define ELF_CLASS ELFCLASS64
721 # define ALIGNMENT 4 /* Required by hardware */
723 # define ALIGN_DOUBLE
725 # define OS_TYPE "SUNOS5"
728 extern char * GC_SysVGetDataStart();
729 # define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
730 # define DATAEND (&_end)
735 # define HEAP_START (ptr_t)0x40000000
737 # define HEAP_START DATAEND
740 /* HEURISTIC1 reportedly no longer works under 2.7. */
741 /* HEURISTIC2 probably works, but this appears to be preferable. */
742 /* Apparently USRSTACK is defined to be USERLIMIT, but in some */
743 /* installations that's undefined. We work around this with a */
745 # include <sys/vmparam.h>
747 /* This should work everywhere, but doesn't. */
748 # define STACKBOTTOM USRSTACK
753 # define GETPAGESIZE() sysconf(_SC_PAGESIZE)
754 /* getpagesize() appeared to be missing from at least one */
755 /* Solaris 5.4 installation. Weird. */
756 # define DYNAMIC_LOADING
759 # define OS_TYPE "SUNOS4"
760 /* [If you have a weak stomach, don't read this.] */
761 /* We would like to use: */
762 /* # define DATASTART ((ptr_t)((((word) (&etext)) + 0x1fff) & ~0x1fff)) */
763 /* This fails occasionally, due to an ancient, but very */
764 /* persistent ld bug. &etext is set 32 bytes too high. */
765 /* We instead read the text segment size from the a.out */
766 /* header, which happens to be mapped into our address space */
767 /* at the start of the text segment. The detective work here */
768 /* was done by Robert Ehrlich, Manuel Serrano, and Bernard */
769 /* Serpette of INRIA. */
770 /* This assumes ZMAGIC, i.e. demand-loadable executables. */
771 # define TEXTSTART 0x2000
772 # define DATASTART ((ptr_t)(*(int *)(TEXTSTART+0x4)+TEXTSTART))
773 # define MPROTECT_VDB
775 # define DYNAMIC_LOADING
778 # define CPP_WORDSZ 32
779 # define OS_TYPE "DRSNX"
780 extern char * GC_SysVGetDataStart();
782 # define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &etext)
783 # define MPROTECT_VDB
784 # define STACKBOTTOM ((ptr_t) 0xdfff0000)
785 # define DYNAMIC_LOADING
788 # define OS_TYPE "LINUX"
790 # define DYNAMIC_LOADING
792 Linux Sparc/a.out not supported
796 # define DATAEND (&_end)
799 # define STACKBOTTOM ((ptr_t) 0x80000000000ULL)
800 # define DATASTART (ptr_t)GC_SysVGetDataStart(0x100000, &_etext)
801 # define CPP_WORDSZ 64
803 # define STACKBOTTOM ((ptr_t) 0xf0000000)
804 # define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
808 # define OS_TYPE "OPENBSD"
809 # define STACKBOTTOM ((ptr_t) 0xf8000000)
811 # define DATASTART ((ptr_t)(&etext))
814 # define OS_TYPE "NETBSD"
817 # define DATASTART GC_data_start
818 # define DYNAMIC_LOADING
821 # define DATASTART ((ptr_t)(&etext))
827 # define MACH_TYPE "I386"
828 # define ALIGNMENT 4 /* Appears to hold for all "32 bit" compilers */
829 /* except Borland. The -a4 option fixes */
831 /* Ivan Demakov: For Watcom the option is -zp4. */
832 # ifndef SMALL_CONFIG
833 # define ALIGN_DOUBLE /* Not strictly necessary, but may give speed */
834 /* improvement on Pentiums. */
836 # ifdef HAVE_BUILTIN_UNWIND_INIT
837 # define USE_GENERIC_PUSH_REGS
840 # define OS_TYPE "SEQUENT"
842 # define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
843 # define STACKBOTTOM ((ptr_t) 0x3ffff000)
846 # define OS_TYPE "BEOS"
848 # define GETPAGESIZE() B_PAGE_SIZE
850 # define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
853 # define OS_TYPE "SUNOS5"
854 extern int _etext, _end;
855 extern char * GC_SysVGetDataStart();
856 # define DATASTART GC_SysVGetDataStart(0x1000, &_etext)
857 # define DATAEND (&_end)
858 /* # define STACKBOTTOM ((ptr_t)(&_start)) worked through 2.7, */
859 /* but reportedly breaks under 2.8. It appears that the stack */
860 /* base is a property of the executable, so this should not break */
861 /* old executables. */
862 /* HEURISTIC2 probably works, but this appears to be preferable. */
863 # include <sys/vmparam.h>
864 # define STACKBOTTOM USRSTACK
865 /** At least in Solaris 2.5, PROC_VDB gives wrong values for dirty bits. */
866 # ifdef SOLARIS25_PROC_VDB_BUG_FIXED
869 # define DYNAMIC_LOADING
874 # define HEAP_START (ptr_t)0x40000000
876 # define HEAP_START DATAEND
880 # define OS_TYPE "SCO"
882 # define DATASTART ((ptr_t)((((word) (&etext)) + 0x3fffff) \
884 +((word)&etext & 0xfff))
885 # define STACKBOTTOM ((ptr_t) 0x7ffffffc)
888 # define OS_TYPE "SCO_ELF"
890 # define DATASTART ((ptr_t)(&etext))
891 # define STACKBOTTOM ((ptr_t) 0x08048000)
892 # define DYNAMIC_LOADING
893 # define ELF_CLASS ELFCLASS32
896 # define OS_TYPE "LINUX"
897 # define LINUX_STACKBOTTOM
901 # define STACK_GRAN 0x10000000
902 /* STACKBOTTOM is usually 0xc0000000, but this changes with */
903 /* different kernel configurations. In particular, systems */
904 /* with 2GB physical memory will usually move the user */
905 /* address space limit, and hence initial SP to 0x80000000. */
907 # if !defined(GC_LINUX_THREADS) || !defined(REDIRECT_MALLOC)
908 # define MPROTECT_VDB
910 /* We seem to get random errors in incremental mode, */
911 /* possibly because Linux threads is itself a malloc client */
912 /* and can't deal with the signals. */
915 # define DYNAMIC_LOADING
916 # ifdef UNDEFINED /* includes ro data */
918 # define DATASTART ((ptr_t)((((word) (&_etext)) + 0xfff) & ~0xfff))
920 # include <features.h>
921 # if defined(__GLIBC__) && __GLIBC__ >= 2
922 # define LINUX_DATA_START
924 extern char **__environ;
925 # define DATASTART ((ptr_t)(&__environ))
926 /* hideous kludge: __environ is the first */
927 /* word in crt0.o, and delimits the start */
928 /* of the data segment, no matter which */
929 /* ld options were passed through. */
930 /* We could use _etext instead, but that */
931 /* would include .rodata, which may */
932 /* contain large read-only data tables */
933 /* that we'd rather not scan. */
936 # define DATAEND (&_end)
939 # define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
941 # ifdef USE_I686_PREFETCH
942 # define PREFETCH(x) \
943 __asm__ __volatile__ (" prefetchnta %0": : "m"(*(char *)(x)))
944 /* Empirically prefetcht0 is much more effective at reducing */
945 /* cache miss stalls for the targetted load instructions. But it */
946 /* seems to interfere enough with other cache traffic that the net */
947 /* result is worse than prefetchnta. */
949 /* Using prefetches for write seems to have a slight negative */
950 /* impact on performance, at least for a PIII/500. */
951 # define PREFETCH_FOR_WRITE(x) \
952 __asm__ __volatile__ (" prefetcht0 %0": : "m"(*(char *)(x)))
955 # ifdef USE_3DNOW_PREFETCH
956 # define PREFETCH(x) \
957 __asm__ __volatile__ (" prefetch %0": : "m"(*(char *)(x)))
958 # define PREFETCH_FOR_WRITE(x) \
959 __asm__ __volatile__ (" prefetchw %0": : "m"(*(char *)(x)))
963 # define OS_TYPE "CYGWIN32"
964 extern int _data_start__;
965 extern int _data_end__;
966 extern int _bss_start__;
967 extern int _bss_end__;
968 /* For binutils 2.9.1, we have */
969 /* DATASTART = _data_start__ */
970 /* DATAEND = _bss_end__ */
971 /* whereas for some earlier versions it was */
972 /* DATASTART = _bss_start__ */
973 /* DATAEND = _data_end__ */
974 /* To get it right for both, we take the */
975 /* minumum/maximum of the two. */
976 # define MAX(x,y) ((x) > (y) ? (x) : (y))
977 # define MIN(x,y) ((x) < (y) ? (x) : (y))
978 # define DATASTART ((ptr_t) MIN(&_data_start__, &_bss_start__))
979 # define DATAEND ((ptr_t) MAX(&_data_end__, &_bss_end__))
981 # define STACK_GRAN 0x10000
985 # define OS_TYPE "OS2"
986 /* STACKBOTTOM and DATASTART are handled specially in */
987 /* os_dep.c. OS2 actually has the right */
989 # define DATAEND /* not needed */
990 # define USE_GENERIC_PUSH_REGS
993 # define OS_TYPE "MSWIN32"
994 /* STACKBOTTOM and DATASTART are handled specially in */
997 # define MPROTECT_VDB
999 # define DATAEND /* not needed */
1002 # define OS_TYPE "MSWINCE"
1003 # define DATAEND /* not needed */
1006 # define OS_TYPE "DJGPP"
1007 # include "stubinfo.h"
1010 extern int __djgpp_stack_limit;
1011 # define DATASTART ((ptr_t)((((word) (&etext)) + 0x1ff) & ~0x1ff))
1012 /* # define STACKBOTTOM ((ptr_t)((word) _stubinfo + _stubinfo->size \
1014 # define STACKBOTTOM ((ptr_t)((word) __djgpp_stack_limit + _stklen))
1015 /* This may not be right. */
1018 # define OS_TYPE "OPENBSD"
1021 # define OS_TYPE "FREEBSD"
1022 # ifndef GC_FREEBSD_THREADS
1023 # define MPROTECT_VDB
1025 # define SIG_SUSPEND SIGUSR1
1026 # define SIG_THR_RESTART SIGUSR2
1027 # define FREEBSD_STACKBOTTOM
1029 # define DYNAMIC_LOADING
1033 # define OS_TYPE "NETBSD"
1036 # define OS_TYPE "THREE86BSD"
1039 # define OS_TYPE "BSDI"
1041 # if defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) \
1042 || defined(THREE86BSD) || defined(BSDI)
1045 # define DATASTART ((ptr_t)(&etext))
1048 # define OS_TYPE "NEXT"
1049 # define DATASTART ((ptr_t) get_etext())
1050 # define STACKBOTTOM ((ptr_t)0xc0000000)
1051 # define DATAEND /* not needed */
1054 # define OS_TYPE "DOS4GW"
1055 extern long __nullarea;
1057 extern char *_STACKTOP;
1058 /* Depending on calling conventions Watcom C either precedes
1059 or does not precedes with undescore names of C-variables.
1060 Make sure startup code variables always have the same names. */
1061 #pragma aux __nullarea "*";
1062 #pragma aux _end "*";
1063 # define STACKBOTTOM ((ptr_t) _STACKTOP)
1064 /* confused? me too. */
1065 # define DATASTART ((ptr_t) &__nullarea)
1066 # define DATAEND ((ptr_t) &_end)
1069 # define OS_TYPE "HURD"
1070 # define STACK_GROWS_DOWN
1072 extern int __data_start;
1073 # define DATASTART ( (ptr_t) (&__data_start))
1075 # define DATAEND ( (ptr_t) (&_end))
1076 /* # define MPROTECT_VDB Not quite working yet? */
1077 # define DYNAMIC_LOADING
1082 # define MACH_TYPE "NS32K"
1083 # define ALIGNMENT 4
1084 extern char **environ;
1085 # define DATASTART ((ptr_t)(&environ))
1086 /* hideous kludge: environ is the first */
1087 /* word in crt0.o, and delimits the start */
1088 /* of the data segment, no matter which */
1089 /* ld options were passed through. */
1090 # define STACKBOTTOM ((ptr_t) 0xfffff000) /* for Encore */
1094 # define MACH_TYPE "MIPS"
1096 /* This was developed for a linuxce style platform. Probably */
1097 /* needs to be tweaked for workstation class machines. */
1098 # define OS_TYPE "LINUX"
1099 extern int __data_start;
1100 # define DATASTART ((ptr_t)(&__data_start))
1101 # define ALIGNMENT 4
1102 # define USE_GENERIC_PUSH_REGS
1103 # define STACKBOTTOM ((ptr_t)0x7fff8000)
1104 /* Older toolchains may need 0x80000000. */
1105 /* In many cases, this should probably use LINUX_STACKBOTTOM */
1106 /* instead. But some kernel versions seem to give the wrong */
1107 /* value from /proc. */
1111 # define DATASTART (ptr_t)0x10000000
1112 /* Could probably be slightly higher since */
1113 /* startup code allocates lots of stuff. */
1114 # define OS_TYPE "ULTRIX"
1115 # define ALIGNMENT 4
1119 # define DATASTART (ptr_t)0x10000000
1120 # define OS_TYPE "RISCOS"
1121 # define ALIGNMENT 4 /* Required by hardware */
1126 # define DATASTART ((ptr_t)(&_fdata))
1128 # define HEAP_START (ptr_t)0x30000000
1130 # define HEAP_START DATASTART
1132 /* Lowest plausible heap address. */
1133 /* In the MMAP case, we map there. */
1134 /* In either case it is used to identify */
1135 /* heap sections so they're not */
1136 /* considered as roots. */
1137 # define OS_TYPE "IRIX5"
1138 # define MPROTECT_VDB
1140 # define CPP_WORDSZ _MIPS_SZPTR
1141 # define ALIGNMENT (_MIPS_SZPTR/8)
1142 # if CPP_WORDSZ != 64
1143 # define ALIGN_DOUBLE
1146 # define ALIGNMENT 4
1147 # define ALIGN_DOUBLE
1149 # define DYNAMIC_LOADING
1152 # define OS_TYPE "MSWINCE"
1153 # define ALIGNMENT 4
1154 # define DATAEND /* not needed */
1156 # if defined(NETBSD)
1157 /* This also checked for __MIPSEL__ . Why? NETBSD recognition */
1158 /* should be handled at the top of the file. */
1159 # define ALIGNMENT 4
1160 # define OS_TYPE "NETBSD"
1162 # define USE_GENERIC_PUSH_REGS
1165 # define DATASTART GC_data_start
1166 # define NEED_FIND_LIMIT
1167 # define DYNAMIC_LOADING
1169 # define DATASTART ((ptr_t) 0x10000000)
1170 # define STACKBOTTOM ((ptr_t) 0x7ffff000)
1176 # define MACH_TYPE "RS6000"
1178 # define ALIGNMENT 8
1179 # define CPP_WORDSZ 64
1181 # define ALIGNMENT 4
1182 # define CPP_WORDSZ 32
1184 extern int _data, _end;
1185 # define DATASTART ((ptr_t)((ulong)&_data))
1186 # define DATAEND ((ptr_t)((ulong)&_end))
1188 # define STACKBOTTOM ((ptr_t)((ulong)&errno))
1189 # define USE_GENERIC_PUSH_REGS
1190 # define DYNAMIC_LOADING
1191 /* For really old versions of AIX, this may have to be removed. */
1195 # define MACH_TYPE "HP_PA"
1197 # define CPP_WORDSZ 64
1198 # define ALIGNMENT 8
1200 # define CPP_WORDSZ 32
1201 # define ALIGNMENT 4
1202 # define ALIGN_DOUBLE
1204 # if !defined(GC_HPUX_THREADS) && !defined(GC_LINUX_THREADS)
1205 # ifndef LINUX /* For now. */
1206 # define MPROTECT_VDB
1209 # define GENERIC_COMPARE_AND_SWAP
1210 /* No compare-and-swap instruction. Use pthread mutexes */
1211 /* when we absolutely have to. */
1212 # ifdef PARALLEL_MARK
1213 # define USE_MARK_BYTES
1214 /* Minimize compare-and-swap usage. */
1217 # define STACK_GROWS_UP
1219 # define OS_TYPE "HPUX"
1220 extern int __data_start;
1221 # define DATASTART ((ptr_t)(&__data_start))
1223 /* The following appears to work for 7xx systems running HP/UX */
1224 /* 9.xx Furthermore, it might result in much faster */
1225 /* collections than HEURISTIC2, which may involve scanning */
1226 /* segments that directly precede the stack. It is not the */
1227 /* default, since it may not work on older machine/OS */
1228 /* combinations. (Thanks to Raymond X.T. Nijssen for uncovering */
1230 # define STACKBOTTOM ((ptr_t) 0x7b033000) /* from /etc/conf/h/param.h */
1232 /* Gustavo Rodriguez-Rivera suggested changing HEURISTIC2 */
1233 /* to this. Note that the GC must be initialized before the */
1234 /* first putenv call. */
1235 extern char ** environ;
1236 # define STACKBOTTOM ((ptr_t)environ)
1238 # define DYNAMIC_LOADING
1239 # include <unistd.h>
1240 # define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
1242 # define PREFETCH(x) { \
1243 register long addr = (long)(x); \
1244 (void) _asm ("LDW", 0, 0, addr, 0); \
1249 # define OS_TYPE "LINUX"
1250 # define LINUX_STACKBOTTOM
1251 # define DYNAMIC_LOADING
1252 # define LINUX_DATA_START
1254 # define DATAEND (&_end)
1259 # define MACH_TYPE "ALPHA"
1260 # define ALIGNMENT 8
1262 # define OS_TYPE "NETBSD"
1264 # define DATASTART GC_data_start
1265 # define ELFCLASS32 32
1266 # define ELFCLASS64 64
1267 # define ELF_CLASS ELFCLASS64
1268 # define CPP_WORDSZ 64
1269 # define DYNAMIC_LOADING
1272 # define OS_TYPE "OPENBSD"
1274 # define CPP_WORDSZ 64
1275 # ifdef __ELF__ /* since OpenBSD/Alpha 2.9 */
1276 # define DATASTART GC_data_start
1277 # define ELFCLASS32 32
1278 # define ELFCLASS64 64
1279 # define ELF_CLASS ELFCLASS64
1280 # else /* ECOFF, until OpenBSD/Alpha 2.7 */
1281 # define DATASTART ((ptr_t) 0x140000000)
1285 # define OS_TYPE "OSF1"
1286 # define DATASTART ((ptr_t) 0x140000000)
1288 # define DATAEND ((ptr_t) &_end)
1289 extern char ** environ;
1290 /* round up from the value of environ to the nearest page boundary */
1291 /* Probably breaks if putenv is called before collector */
1292 /* initialization. */
1293 # define STACKBOTTOM ((ptr_t)(((word)(environ) | (getpagesize()-1))+1))
1294 /* # define HEURISTIC2 */
1295 /* Normally HEURISTIC2 is too conervative, since */
1296 /* the text segment immediately follows the stack. */
1297 /* Hence we give an upper pound. */
1298 /* This is currently unused, since we disabled HEURISTIC2 */
1300 # define HEURISTIC2_LIMIT ((ptr_t)((word)(&__start) & ~(getpagesize()-1)))
1301 # define CPP_WORDSZ 64
1302 # define MPROTECT_VDB
1303 # define DYNAMIC_LOADING
1306 # define OS_TYPE "LINUX"
1307 # define CPP_WORDSZ 64
1308 # define STACKBOTTOM ((ptr_t) 0x120000000)
1310 # define SEARCH_FOR_DATA_START
1311 # define DATASTART GC_data_start
1312 # define DYNAMIC_LOADING
1314 # define DATASTART ((ptr_t) 0x140000000)
1317 # define DATAEND (&_end)
1318 # define MPROTECT_VDB
1319 /* Has only been superficially tested. May not */
1320 /* work on all versions. */
1325 # define MACH_TYPE "IA64"
1326 # define USE_GENERIC_PUSH_REGS
1327 /* We need to get preserved registers in addition to register */
1328 /* windows. That's easiest to do with setjmp. */
1329 # ifdef PARALLEL_MARK
1330 # define USE_MARK_BYTES
1331 /* Compare-and-exchange is too expensive to use for */
1332 /* setting mark bits. */
1336 # define CPP_WORDSZ 32
1337 # define ALIGN_DOUBLE
1338 /* Requires 8 byte alignment for malloc */
1339 # define ALIGNMENT 4
1344 # define CPP_WORDSZ 64
1345 # define ALIGN_DOUBLE
1346 /* Requires 16 byte alignment for malloc */
1347 # define ALIGNMENT 8
1349 # define OS_TYPE "HPUX"
1350 extern int __data_start;
1351 # define DATASTART ((ptr_t)(&__data_start))
1352 /* Gustavo Rodriguez-Rivera suggested changing HEURISTIC2 */
1353 /* to this. Note that the GC must be initialized before the */
1354 /* first putenv call. */
1355 extern char ** environ;
1356 # define STACKBOTTOM ((ptr_t)environ)
1357 # define DYNAMIC_LOADING
1358 # include <unistd.h>
1359 # define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
1360 /* The following was empirically determined, and is probably */
1361 /* not very robust. */
1362 /* Note that the backing store base seems to be at a nice */
1363 /* address minus one page. */
1364 # define BACKING_STORE_DISPLACEMENT 0x1000000
1365 # define BACKING_STORE_ALIGNMENT 0x1000
1366 # define BACKING_STORE_BASE \
1367 (ptr_t)(((word)GC_stackbottom - BACKING_STORE_DISPLACEMENT - 1) \
1368 & ~(BACKING_STORE_ALIGNMENT - 1))
1371 # define CPP_WORDSZ 64
1372 # define ALIGN_DOUBLE
1373 /* Requires 16 byte alignment for malloc */
1374 # define ALIGNMENT 8
1375 # define OS_TYPE "LINUX"
1376 /* The following works on NUE and older kernels: */
1377 /* # define STACKBOTTOM ((ptr_t) 0xa000000000000000l) */
1378 /* This does not work on NUE: */
1379 # define LINUX_STACKBOTTOM
1380 /* We also need the base address of the register stack */
1381 /* backing store. This is computed in */
1382 /* GC_linux_register_stack_base based on the following */
1384 # define BACKING_STORE_ALIGNMENT 0x100000
1385 # define BACKING_STORE_DISPLACEMENT 0x80000000
1386 extern char * GC_register_stackbottom;
1387 # define BACKING_STORE_BASE ((ptr_t)GC_register_stackbottom)
1388 # define SEARCH_FOR_DATA_START
1389 # define DATASTART GC_data_start
1390 # define DYNAMIC_LOADING
1391 # define MPROTECT_VDB
1392 /* Requires Linux 2.3.47 or later. */
1394 # define DATAEND (&_end)
1396 # define PREFETCH(x) \
1397 __asm__ (" lfetch [%0]": : "r"((void *)(x)))
1398 # define PREFETCH_FOR_WRITE(x) \
1399 __asm__ (" lfetch.excl [%0]": : "r"((void *)(x)))
1400 # define CLEAR_DOUBLE(x) \
1401 __asm__ (" stf.spill [%0]=f0": : "r"((void *)(x)))
1407 # define MACH_TYPE "M88K"
1408 # define ALIGNMENT 4
1409 # define ALIGN_DOUBLE
1412 # define OS_TYPE "CX_UX"
1413 # define DATASTART ((((word)&etext + 0x3fffff) & ~0x3fffff) + 0x10000)
1416 # define OS_TYPE "DGUX"
1417 extern char * GC_SysVGetDataStart();
1418 # define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &etext)
1420 # define STACKBOTTOM ((char*)0xf0000000) /* determined empirically */
1424 # define MACH_TYPE "S370"
1425 # define ALIGNMENT 4 /* Required by hardware */
1426 # define USE_GENERIC_PUSH_REGS
1428 # define OS_TYPE "UTS4"
1432 extern char * GC_SysVGetDataStart();
1433 # define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
1434 # define DATAEND (&_end)
1438 # define OS_TYPE "LINUX"
1440 # define DYNAMIC_LOADING
1441 extern int __data_start;
1442 # define DATASTART ((ptr_t)(&__data_start))
1447 # define ALIGNMENT 4
1449 # define DATASTART ((ptr_t)(&_etext))
1454 # define CPP_WORDSZ 32
1455 # define MACH_TYPE "ARM32"
1456 # define ALIGNMENT 4
1458 # define OS_TYPE "NETBSD"
1461 # define DATASTART ((ptr_t)(&etext))
1462 # define USE_GENERIC_PUSH_REGS
1465 # define OS_TYPE "LINUX"
1468 # define STACK_GRAN 0x10000000
1469 # define USE_GENERIC_PUSH_REGS
1471 # define DYNAMIC_LOADING
1472 # include <features.h>
1473 # if defined(__GLIBC__) && __GLIBC__ >= 2
1474 # define LINUX_DATA_START
1476 extern char **__environ;
1477 # define DATASTART ((ptr_t)(&__environ))
1478 /* hideous kludge: __environ is the first */
1479 /* word in crt0.o, and delimits the start */
1480 /* of the data segment, no matter which */
1481 /* ld options were passed through. */
1482 /* We could use _etext instead, but that */
1483 /* would include .rodata, which may */
1484 /* contain large read-only data tables */
1485 /* that we'd rather not scan. */
1488 # define DATAEND (&_end)
1491 # define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
1495 # define OS_TYPE "MSWINCE"
1496 # define DATAEND /* not needed */
1501 # define MACH_TYPE "SH"
1502 # define ALIGNMENT 4
1504 # define OS_TYPE "MSWINCE"
1505 # define DATAEND /* not needed */
1508 # define OS_TYPE "LINUX"
1509 # define STACKBOTTOM ((ptr_t) 0x7c000000)
1510 # define USE_GENERIC_PUSH_REGS
1511 # define DYNAMIC_LOADING
1512 # define LINUX_DATA_START
1514 # define DATAEND (&_end)
1519 # define MACH_TYPE "SH4"
1520 # define OS_TYPE "MSWINCE"
1521 # define ALIGNMENT 4
1522 # define DATAEND /* not needed */
1525 #ifdef LINUX_DATA_START
1526 /* Some Linux distributions arrange to define __data_start. Some */
1527 /* define data_start as a weak symbol. The latter is technically */
1528 /* broken, since the user program may define data_start, in which */
1529 /* case we lose. Nonetheless, we try both, prefering __data_start. */
1530 /* We assume gcc. */
1531 # pragma weak __data_start
1532 extern int __data_start;
1533 # pragma weak data_start
1534 extern int data_start;
1535 # define DATASTART ((ptr_t)(&__data_start != 0? &__data_start : &data_start))
1538 #if defined(LINUX) && defined(REDIRECT_MALLOC)
1539 /* Rld appears to allocate some memory with its own allocator, and */
1540 /* some through malloc, which might be redirected. To make this */
1541 /* work with collectable memory, we have to scan memory allocated */
1542 /* by rld's internal malloc. */
1543 # define USE_PROC_FOR_LIBRARIES
1546 # ifndef STACK_GROWS_UP
1547 # define STACK_GROWS_DOWN
1551 # define CPP_WORDSZ 32
1560 # define DATAEND (&end)
1563 # if defined(SVR4) && !defined(GETPAGESIZE)
1564 # include <unistd.h>
1565 # define GETPAGESIZE() sysconf(_SC_PAGESIZE)
1568 # ifndef GETPAGESIZE
1569 # if defined(SUNOS5) || defined(IRIX5)
1570 # include <unistd.h>
1572 # define GETPAGESIZE() getpagesize()
1575 # if defined(SUNOS5) || defined(DRSNX) || defined(UTS4)
1576 /* OS has SVR4 generic features. Probably others also qualify. */
1580 # if defined(SUNOS5) || defined(DRSNX)
1581 /* OS has SUNOS5 style semi-undocumented interface to dynamic */
1584 /* OS has SUNOS5 style signal handlers. */
1592 # if defined(SVR4) || defined(LINUX) || defined(IRIX) || defined(HPUX) \
1593 || defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) \
1594 || defined(BSD) || defined(_AIX) || defined(MACOSX) || defined(OSF1)
1595 # define UNIX_LIKE /* Basic Unix-like system calls work. */
1598 # if CPP_WORDSZ != 32 && CPP_WORDSZ != 64
1603 # undef DYNAMIC_LOADING
1608 # undef MPROTECT_VDB
1613 /* Postponed for now. */
1615 # undef MPROTECT_VDB
1618 # ifdef SMALL_CONFIG
1619 /* Presumably not worth the space it takes. */
1621 # undef MPROTECT_VDB
1625 # undef MPROTECT_VDB /* Can't deal with address space holes. */
1628 # ifdef PARALLEL_MARK
1629 # undef MPROTECT_VDB /* For now. */
1632 # if !defined(PCR_VDB) && !defined(PROC_VDB) && !defined(MPROTECT_VDB)
1633 # define DEFAULT_VDB
1637 # define PREFETCH(x)
1638 # define NO_PREFETCH
1641 # ifndef PREFETCH_FOR_WRITE
1642 # define PREFETCH_FOR_WRITE(x)
1643 # define NO_PREFETCH_FOR_WRITE
1646 # ifndef CACHE_LINE_SIZE
1647 # define CACHE_LINE_SIZE 32 /* Wild guess */
1650 # ifndef CLEAR_DOUBLE
1651 # define CLEAR_DOUBLE(x) \
1652 ((word*)x)[0] = 0; \
1654 # endif /* CLEAR_DOUBLE */
1656 /* Internally we use GC_SOLARIS_THREADS to test for either old or pthreads. */
1657 # if defined(GC_SOLARIS_PTHREADS) && !defined(GC_SOLARIS_THREADS)
1658 # define GC_SOLARIS_THREADS
1661 # if defined(GC_IRIX_THREADS) && !defined(IRIX5)
1662 --> inconsistent configuration
1664 # if defined(GC_LINUX_THREADS) && !defined(LINUX)
1665 --> inconsistent configuration
1667 # if defined(GC_SOLARIS_THREADS) && !defined(SUNOS5)
1668 --> inconsistent configuration
1670 # if defined(GC_HPUX_THREADS) && !defined(HPUX)
1671 --> inconsistent configuration
1673 # if defined(GC_WIN32_THREADS) && !defined(MSWIN32)
1674 /* Ideally CYGWIN32 should work, in addition to MSWIN32. I suspect */
1675 /* the necessary code is mostly there, but nobody has actually made */
1676 /* sure the right combination of pieces is compiled in, etc. */
1677 --> inconsistent configuration
1680 # if defined(PCR) || defined(SRC_M3) || \
1681 defined(GC_SOLARIS_THREADS) || defined(GC_WIN32_THREADS) || \
1682 defined(GC_PTHREADS)
1686 # if defined(HP_PA) || defined(M88K) || defined(POWERPC) && !defined(MACOSX) \
1687 || defined(LINT) || defined(MSWINCE) \
1688 || (defined(I386) && defined(__LCC__))
1689 /* Use setjmp based hack to mark from callee-save registers. */
1690 /* The define should move to the individual platform */
1692 # define USE_GENERIC_PUSH_REGS
1694 # if defined(I386) && defined(LINUX)
1695 /* SAVE_CALL_CHAIN is supported if the code is compiled to save */
1696 /* frame pointers by default, i.e. no -fomit-frame-pointer flag. */
1697 # ifdef SAVE_CALL_COUNT
1698 # define SAVE_CALL_CHAIN
1702 # define SAVE_CALL_CHAIN
1703 # define ASM_CLEAR_CODE /* Stack clearing is crucial, and we */
1704 /* include assembly code to do it well. */
1707 # endif /* GCCONFIG_H */