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.
6 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
7 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
9 * Permission is hereby granted to use or copy this program
10 * for any purpose, provided the above notices are retained on all copies.
11 * Permission to modify the code and to distribute modified code is granted,
12 * provided the above notices are retained, and a notice that the code was
13 * modified is included with the above copyright notice.
20 /* Machine dependent parameters. Some tuning parameters can be found */
21 /* near the top of gc_private.h. */
23 /* Machine specific parts contributed by various people. See README file. */
25 /* First a unified test for Linux: */
26 # if defined(linux) || defined(__linux__)
30 /* Determine the machine type: */
31 # if defined(sun) && defined(mc68000)
34 # define mach_type_known
36 # if defined(hp9000s300)
39 # define mach_type_known
41 # if defined(__OpenBSD__) && defined(m68k)
44 # define mach_type_known
46 # if defined(__OpenBSD__) && defined(__sparc__)
49 # define mach_type_known
51 # if defined(__NetBSD__) && defined(m68k)
54 # define mach_type_known
63 # define mach_type_known
65 # if defined(mips) || defined(__mips)
67 # if defined(ultrix) || defined(__ultrix) || defined(__NetBSD__)
70 # if defined(_SYSTYPE_SVR4) || defined(SYSTYPE_SVR4) || defined(__SYSTYPE_SVR4__)
71 # define IRIX5 /* or IRIX 6.X */
73 # define RISCOS /* or IRIX 4.X */
76 # define mach_type_known
78 # if defined(sequent) && defined(i386)
81 # define mach_type_known
83 # if defined(sun) && defined(i386)
86 # define mach_type_known
88 # if (defined(__OS2__) || defined(__EMX__)) && defined(__32BIT__)
91 # define mach_type_known
95 # define mach_type_known
97 # if defined(sun) && (defined(sparc) || defined(__sparc))
99 /* Test for SunOS 5.x */
106 # define mach_type_known
108 # if defined(sparc) && defined(unix) && !defined(sun) && !defined(linux) \
109 && !defined(__OpenBSD__)
112 # define mach_type_known
116 # define mach_type_known
118 # if defined(_M_XENIX) && defined(_M_SYSV) && defined(_M_I386)
119 /* The above test may need refinement */
121 # if defined(_SCO_ELF)
126 # define mach_type_known
128 # if defined(_AUX_SOURCE)
131 # define mach_type_known
133 # if defined(_PA_RISC1_0) || defined(_PA_RISC1_1) \
134 || defined(hppa) || defined(__hppa__)
136 # define mach_type_known
138 # if defined(LINUX) && (defined(i386) || defined(__i386__))
140 # define mach_type_known
142 # if defined(LINUX) && defined(powerpc)
144 # define mach_type_known
146 # if defined(LINUX) && defined(__mc68000__)
148 # define mach_type_known
150 # if defined(LINUX) && defined(sparc)
152 # define mach_type_known
154 # if defined(__alpha) || defined(__alpha__)
157 # define OSF1 /* a.k.a Digital Unix */
159 # define mach_type_known
161 # if defined(_AMIGA) && !defined(AMIGA)
166 # define mach_type_known
168 # if defined(THINK_C) || defined(__MWERKS__) && !defined(__powerc)
171 # define mach_type_known
173 # if defined(__MWERKS__) && defined(__powerc)
176 # define mach_type_known
181 # define mach_type_known
183 # if defined(NeXT) && defined(mc68000)
186 # define mach_type_known
188 # if defined(NeXT) && defined(i386)
191 # define mach_type_known
193 # if defined(__OpenBSD__) && defined(i386)
196 # define mach_type_known
198 # if defined(__FreeBSD__) && defined(i386)
201 # define mach_type_known
203 # if defined(__NetBSD__) && defined(i386)
206 # define mach_type_known
208 # if defined(bsdi) && defined(i386)
211 # define mach_type_known
213 # if !defined(mach_type_known) && defined(__386BSD__)
216 # define mach_type_known
218 # if defined(_CX_UX) && defined(_M88K)
221 # define mach_type_known
226 # define mach_type_known
228 # if (defined(_MSDOS) || defined(_MSC_VER)) && (_M_IX86 >= 300) \
229 || defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__)
231 # define MSWIN32 /* or Win32s */
232 # define mach_type_known
234 # if defined(__DJGPP__)
237 # define DJGPP /* MSDOS running the DJGPP port of GCC */
239 # define mach_type_known
241 # if defined(__CYGWIN32__) || defined(__CYGWIN__)
244 # define mach_type_known
246 # if defined(__BORLANDC__)
249 # define mach_type_known
251 # if defined(_UTS) && !defined(mach_type_known)
254 # define mach_type_known
257 # if defined(__WATCOMC__) && defined(__386__)
259 # if !defined(OS2) && !defined(MSWIN32) && !defined(DOS4GW)
260 # if defined(__OS2__)
263 # if defined(__WINDOWS_386__) || defined(__NT__)
270 # define mach_type_known
273 /* Feel free to add more clauses here */
275 /* Or manually define the machine type here. A machine type is */
276 /* characterized by the architecture. Some */
277 /* machine types are further subdivided by OS. */
278 /* the macros ULTRIX, RISCOS, and BSD to distinguish. */
279 /* Note that SGI IRIX is treated identically to RISCOS. */
280 /* SYSV on an M68K actually means A/UX. */
281 /* The distinction in these cases is usually the stack starting address */
282 # ifndef mach_type_known
283 --> unknown machine type
285 /* Mapping is: M68K ==> Motorola 680X0 */
286 /* (SUNOS4,HP,NEXT, and SYSV (A/UX), */
287 /* MACOS and AMIGA variants) */
288 /* I386 ==> Intel 386 */
289 /* (SEQUENT, OS2, SCO, LINUX, NETBSD, */
290 /* FREEBSD, THREE86BSD, MSWIN32, */
291 /* BSDI,SUNOS5, NEXT, other variants) */
292 /* NS32K ==> Encore Multimax */
293 /* MIPS ==> R2000 or R3000 */
294 /* (RISCOS, ULTRIX variants) */
295 /* VAX ==> DEC VAX */
296 /* (BSD, ULTRIX variants) */
297 /* RS6000 ==> IBM RS/6000 AIX3.X */
298 /* RT ==> IBM PC/RT */
299 /* HP_PA ==> HP9000/700 & /800 */
301 /* SPARC ==> SPARC under SunOS */
302 /* (SUNOS4, SUNOS5, */
303 /* DRSNX variants) */
304 /* ALPHA ==> DEC Alpha */
305 /* (OSF1 and LINUX variants) */
306 /* M88K ==> Motorola 88XX0 */
307 /* (CX_UX and DGUX) */
308 /* S370 ==> 370-like machine */
309 /* running Amdahl UTS4 */
313 * For each architecture and OS, the following need to be defined:
315 * CPP_WORD_SZ is a simple integer constant representing the word size.
316 * in bits. We assume byte addressibility, where a byte has 8 bits.
317 * We also assume CPP_WORD_SZ is either 32 or 64.
318 * (We care about the length of pointers, not hardware
319 * bus widths. Thus a 64 bit processor with a C compiler that uses
320 * 32 bit pointers should use CPP_WORD_SZ of 32, not 64. Default is 32.)
322 * MACH_TYPE is a string representation of the machine type.
323 * OS_TYPE is analogous for the OS.
325 * ALIGNMENT is the largest N, such that
326 * all pointer are guaranteed to be aligned on N byte boundaries.
327 * defining it to be 1 will always work, but perform poorly.
329 * DATASTART is the beginning of the data segment.
330 * On UNIX systems, the collector will scan the area between DATASTART
331 * and DATAEND for root pointers.
333 * DATAEND, if not &end.
335 * ALIGN_DOUBLE of GC_malloc should return blocks aligned to twice
338 * STACKBOTTOM is the cool end of the stack, which is usually the
339 * highest address in the stack.
340 * Under PCR or OS/2, we have other ways of finding thread stacks.
341 * For each machine, the following should:
342 * 1) define STACK_GROWS_UP if the stack grows toward higher addresses, and
343 * 2) define exactly one of
344 * STACKBOTTOM (should be defined to be an expression)
347 * If either of the last two macros are defined, then STACKBOTTOM is computed
348 * during collector startup using one of the following two heuristics:
349 * HEURISTIC1: Take an address inside GC_init's frame, and round it up to
350 * the next multiple of STACK_GRAN.
351 * HEURISTIC2: Take an address inside GC_init's frame, increment it repeatedly
352 * in small steps (decrement if STACK_GROWS_UP), and read the value
353 * at each location. Remember the value when the first
354 * Segmentation violation or Bus error is signalled. Round that
355 * to the nearest plausible page boundary, and use that instead
358 * If no expression for STACKBOTTOM can be found, and neither of the above
359 * heuristics are usable, the collector can still be used with all of the above
360 * undefined, provided one of the following is done:
361 * 1) GC_mark_roots can be changed to somehow mark from the correct stack(s)
362 * without reference to STACKBOTTOM. This is appropriate for use in
363 * conjunction with thread packages, since there will be multiple stacks.
364 * (Allocating thread stacks in the heap, and treating them as ordinary
365 * heap data objects is also possible as a last resort. However, this is
366 * likely to introduce significant amounts of excess storage retention
367 * unless the dead parts of the thread stacks are periodically cleared.)
368 * 2) Client code may set GC_stackbottom before calling any GC_ routines.
369 * If the author of the client code controls the main program, this is
370 * easily accomplished by introducing a new main program, setting
371 * GC_stackbottom to the address of a local variable, and then calling
372 * the original main program. The new main program would read something
375 * # include "gc_private.h"
377 * main(argc, argv, envp)
379 * char **argv, **envp;
383 * GC_stackbottom = (ptr_t)(&dummy);
384 * return(real_main(argc, argv, envp));
388 * Each architecture may also define the style of virtual dirty bit
389 * implementation to be used:
390 * MPROTECT_VDB: Write protect the heap and catch faults.
391 * PROC_VDB: Use the SVR4 /proc primitives to read dirty bits.
393 * An architecture may define DYNAMIC_LOADING if dynamic_load.c
394 * defined GC_register_dynamic_libraries() for the architecture.
398 # define STACK_GRAN 0x1000000
400 # define MACH_TYPE "M68K"
403 # define OS_TYPE "OPENBSD"
406 # define DATASTART ((ptr_t)(&etext))
409 # define OS_TYPE "NETBSD"
412 # define DATASTART ((ptr_t)(&etext))
415 # define OS_TYPE "LINUX"
416 # define STACKBOTTOM ((ptr_t)0xf0000000)
417 # define MPROTECT_VDB
419 # define DYNAMIC_LOADING
420 extern char **__environ;
421 # define DATASTART ((ptr_t)(&__environ))
422 /* hideous kludge: __environ is the first */
423 /* word in crt0.o, and delimits the start */
424 /* of the data segment, no matter which */
425 /* ld options were passed through. */
426 /* We could use _etext instead, but that */
427 /* would include .rodata, which may */
428 /* contain large read-only data tables */
429 /* that we'd rather not scan. */
431 # define DATAEND (&_end)
434 # define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
438 # define OS_TYPE "SUNOS4"
440 # define DATASTART ((ptr_t)((((word) (&etext)) + 0x1ffff) & ~0x1ffff))
441 # define HEURISTIC1 /* differs */
442 # define DYNAMIC_LOADING
445 # define OS_TYPE "HP"
447 # define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
448 # define STACKBOTTOM ((ptr_t) 0xffeffffc)
449 /* empirically determined. seems to work. */
451 # define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
454 # define OS_TYPE "SYSV"
456 # define DATASTART ((ptr_t)((((word) (&etext)) + 0x3fffff) \
458 +((word)&etext & 0x1fff))
459 /* This only works for shared-text binaries with magic number 0413.
460 The other sorts of SysV binaries put the data at the end of the text,
461 in which case the default of &etext would work. Unfortunately,
462 handling both would require having the magic-number available.
465 # define STACKBOTTOM ((ptr_t)0xFFFFFFFE)
466 /* The stack starts at the top of memory, but */
467 /* 0x0 cannot be used as setjump_test complains */
468 /* that the stack direction is incorrect. Two */
469 /* bytes down from 0x0 should be safe enough. */
471 # include <sys/mmu.h>
472 # define GETPAGESIZE() PAGESIZE /* Is this still right? */
475 # define OS_TYPE "AMIGA"
476 /* STACKBOTTOM and DATASTART handled specially */
478 # define DATAEND /* not needed */
479 # define GETPAGESIZE() 4096
485 # define OS_TYPE "MACOS"
486 /* see os_dep.c for details of global data segments. */
487 # define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
488 # define DATAEND /* not needed */
489 # define GETPAGESIZE() 4096
492 # define OS_TYPE "NEXT"
493 # define DATASTART ((ptr_t) get_etext())
494 # define STACKBOTTOM ((ptr_t) 0x4000000)
495 # define DATAEND /* not needed */
500 # define MACH_TYPE "POWERPC"
502 # define ALIGNMENT 2 /* Still necessary? Could it be 4? */
506 # define OS_TYPE "MACOS"
507 /* see os_dep.c for details of global data segments. */
508 # define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
509 # define DATAEND /* not needed */
512 # define ALIGNMENT 4 /* Guess. Can someone verify? */
513 /* This was 2, but that didn't sound right. */
514 # define OS_TYPE "LINUX"
517 # define STACK_GRAN 0x10000000
518 /* Stack usually starts at 0x80000000 */
519 # define DATASTART GC_data_start
521 # define DATAEND (&_end)
525 # define OS_TYPE "MACOSX"
526 # define DATASTART ((ptr_t) get_etext())
527 # define STACKBOTTOM ((ptr_t) 0xc0000000)
528 # define DATAEND /* not needed */
533 # define MACH_TYPE "VAX"
534 # define ALIGNMENT 4 /* Pointers are longword aligned by 4.2 C compiler */
536 # define DATASTART ((ptr_t)(&etext))
538 # define OS_TYPE "BSD"
540 /* HEURISTIC2 may be OK, but it's hard to test. */
543 # define OS_TYPE "ULTRIX"
544 # define STACKBOTTOM ((ptr_t) 0x7fffc800)
549 # define MACH_TYPE "RT"
551 # define DATASTART ((ptr_t) 0x10000000)
552 # define STACKBOTTOM ((ptr_t) 0x1fffd800)
556 # define MACH_TYPE "SPARC"
557 # define ALIGNMENT 4 /* Required by hardware */
558 # define ALIGN_DOUBLE
561 # define OS_TYPE "SUNOS5"
564 extern char * GC_SysVGetDataStart();
565 # define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
566 # define DATAEND (&_end)
571 # define HEAP_START (ptr_t)0x40000000
573 # define HEAP_START DATAEND
576 /* HEURISTIC1 reportedly no longer works under 2.7. Thus we */
577 /* switched to HEURISTIC2, eventhough it creates some debugging */
581 # define GETPAGESIZE() sysconf(_SC_PAGESIZE)
582 /* getpagesize() appeared to be missing from at least one */
583 /* Solaris 5.4 installation. Weird. */
584 # define DYNAMIC_LOADING
587 # define OS_TYPE "SUNOS4"
588 /* [If you have a weak stomach, don't read this.] */
589 /* We would like to use: */
590 /* # define DATASTART ((ptr_t)((((word) (&etext)) + 0x1fff) & ~0x1fff)) */
591 /* This fails occasionally, due to an ancient, but very */
592 /* persistent ld bug. &etext is set 32 bytes too high. */
593 /* We instead read the text segment size from the a.out */
594 /* header, which happens to be mapped into our address space */
595 /* at the start of the text segment. The detective work here */
596 /* was done by Robert Ehrlich, Manuel Serrano, and Bernard */
597 /* Serpette of INRIA. */
598 /* This assumes ZMAGIC, i.e. demand-loadable executables. */
599 # define TEXTSTART 0x2000
600 # define DATASTART ((ptr_t)(*(int *)(TEXTSTART+0x4)+TEXTSTART))
601 # define MPROTECT_VDB
603 # define DYNAMIC_LOADING
606 # define CPP_WORDSZ 32
607 # define OS_TYPE "DRSNX"
608 extern char * GC_SysVGetDataStart();
610 # define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &etext)
611 # define MPROTECT_VDB
612 # define STACKBOTTOM ((ptr_t) 0xdfff0000)
613 # define DYNAMIC_LOADING
616 # define OS_TYPE "LINUX"
618 # define DATASTART GC_data_start
619 # define DYNAMIC_LOADING
621 Linux Sparc non elf ?
624 # define DATAEND (&_end)
626 # define STACKBOTTOM ((ptr_t) 0xf0000000)
629 # define OS_TYPE "OPENBSD"
630 # define STACKBOTTOM ((ptr_t) 0xf8000000)
631 # define DATASTART ((ptr_t)(&etext))
636 # define MACH_TYPE "I386"
637 # define ALIGNMENT 4 /* Appears to hold for all "32 bit" compilers */
638 /* except Borland. The -a4 option fixes */
640 /* Ivan Demakov: For Watcom the option is -zp4. */
641 # ifndef SMALL_CONFIG
642 # define ALIGN_DOUBLE /* Not strictly necessary, but may give speed */
643 /* improvement on Pentiums. */
646 # define OS_TYPE "SEQUENT"
648 # define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
649 # define STACKBOTTOM ((ptr_t) 0x3ffff000)
652 # define OS_TYPE "SUNOS5"
653 extern int etext, _start;
654 extern char * GC_SysVGetDataStart();
655 # define DATASTART GC_SysVGetDataStart(0x1000, &etext)
656 # define STACKBOTTOM ((ptr_t)(&_start))
657 /** At least in Solaris 2.5, PROC_VDB gives wrong values for dirty bits. */
658 /*# define PROC_VDB*/
659 # define DYNAMIC_LOADING
664 # define HEAP_START (ptr_t)0x40000000
666 # define HEAP_START DATAEND
670 # define OS_TYPE "SCO"
672 # define DATASTART ((ptr_t)((((word) (&etext)) + 0x3fffff) \
674 +((word)&etext & 0xfff))
675 # define STACKBOTTOM ((ptr_t) 0x7ffffffc)
678 # define OS_TYPE "SCO_ELF"
680 # define DATASTART ((ptr_t)(&etext))
681 # define STACKBOTTOM ((ptr_t) 0x08048000)
682 # define DYNAMIC_LOADING
683 # define ELF_CLASS ELFCLASS32
686 # define OS_TYPE "LINUX"
689 # define STACK_GRAN 0x10000000
690 /* STACKBOTTOM is usually 0xc0000000, but this changes with */
691 /* different kernel configurations. In particular, systems */
692 /* with 2GB physical memory will usually move the user */
693 /* address space limit, and hence initial SP to 0x80000000. */
694 # if !defined(LINUX_THREADS) || !defined(REDIRECT_MALLOC)
695 # define MPROTECT_VDB
697 /* We seem to get random errors in incremental mode, */
698 /* possibly because Linux threads is itself a malloc client */
699 /* and can't deal with the signals. */
702 # define DYNAMIC_LOADING
703 # ifdef UNDEFINED /* includes ro data */
705 # define DATASTART ((ptr_t)((((word) (&_etext)) + 0xfff) & ~0xfff))
707 # include <features.h>
708 # if defined(__GLIBC__) && __GLIBC__ >= 2
709 extern int __data_start;
710 # define DATASTART ((ptr_t)(&__data_start))
712 extern char **__environ;
713 # define DATASTART ((ptr_t)(&__environ))
714 /* hideous kludge: __environ is the first */
715 /* word in crt0.o, and delimits the start */
716 /* of the data segment, no matter which */
717 /* ld options were passed through. */
718 /* We could use _etext instead, but that */
719 /* would include .rodata, which may */
720 /* contain large read-only data tables */
721 /* that we'd rather not scan. */
724 # define DATAEND (&_end)
727 # define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
731 # define OS_TYPE "CYGWIN32"
732 extern int _data_start__;
733 extern int _data_end__;
734 extern int _bss_start__;
735 extern int _bss_end__;
736 /* For binutils 2.9.1, we have */
737 /* DATASTART = _data_start__ */
738 /* DATAEND = _bss_end__ */
739 /* whereas for some earlier versions it was */
740 /* DATASTART = _bss_start__ */
741 /* DATAEND = _data_end__ */
742 /* To get it right for both, we take the */
743 /* minumum/maximum of the two. */
744 # define MAX(x,y) ((x) > (y) ? (x) : (y))
745 # define MIN(x,y) ((x) < (y) ? (x) : (y))
746 # define DATASTART ((ptr_t) MIN(&_data_start__, &_bss_start__))
747 # define DATAEND ((ptr_t) MAX(&_data_end__, &_bss_end__))
749 # define STACK_GRAN 0x10000
753 # define OS_TYPE "OS2"
754 /* STACKBOTTOM and DATASTART are handled specially in */
755 /* os_dep.c. OS2 actually has the right */
757 # define DATAEND /* not needed */
760 # define OS_TYPE "MSWIN32"
761 /* STACKBOTTOM and DATASTART are handled specially in */
764 # define MPROTECT_VDB
766 # define DATAEND /* not needed */
769 # define OS_TYPE "DJGPP"
770 # include "stubinfo.h"
773 extern int __djgpp_stack_limit;
774 # define DATASTART ((ptr_t)((((word) (&etext)) + 0x1ff) & ~0x1ff))
775 /* # define STACKBOTTOM ((ptr_t)((word) _stubinfo + _stubinfo->size \
777 # define STACKBOTTOM ((ptr_t)((word) __djgpp_stack_limit + _stklen))
778 /* This may not be right. */
781 # define OS_TYPE "OPENBSD"
784 # define OS_TYPE "FREEBSD"
785 # define MPROTECT_VDB
788 # define OS_TYPE "NETBSD"
791 # define OS_TYPE "THREE86BSD"
794 # define OS_TYPE "BSDI"
796 # if defined(OPENBSD) || defined(FREEBSD) || defined(NETBSD) \
797 || defined(THREE86BSD) || defined(BSDI)
800 # define DATASTART ((ptr_t)(&etext))
803 # define OS_TYPE "NEXT"
804 # define DATASTART ((ptr_t) get_etext())
805 # define STACKBOTTOM ((ptr_t)0xc0000000)
806 # define DATAEND /* not needed */
809 # define OS_TYPE "DOS4GW"
810 extern long __nullarea;
812 extern char *_STACKTOP;
813 /* Depending on calling conventions Watcom C either precedes
814 or does not precedes with undescore names of C-variables.
815 Make sure startup code variables always have the same names. */
816 #pragma aux __nullarea "*";
817 #pragma aux _end "*";
818 # define STACKBOTTOM ((ptr_t) _STACKTOP)
819 /* confused? me too. */
820 # define DATASTART ((ptr_t) &__nullarea)
821 # define DATAEND ((ptr_t) &_end)
826 # define MACH_TYPE "NS32K"
828 extern char **environ;
829 # define DATASTART ((ptr_t)(&environ))
830 /* hideous kludge: environ is the first */
831 /* word in crt0.o, and delimits the start */
832 /* of the data segment, no matter which */
833 /* ld options were passed through. */
834 # define STACKBOTTOM ((ptr_t) 0xfffff000) /* for Encore */
838 # define MACH_TYPE "MIPS"
840 # define DATASTART (ptr_t)0x10000000
841 /* Could probably be slightly higher since */
842 /* startup code allocates lots of stuff. */
845 # define DATASTART ((ptr_t)(&_fdata))
847 # define HEAP_START (ptr_t)0x30000000
849 # define HEAP_START DATASTART
851 /* Lowest plausible heap address. */
852 /* In the MMAP case, we map there. */
853 /* In either case it is used to identify */
854 /* heap sections so they're not */
855 /* considered as roots. */
858 /* # define STACKBOTTOM ((ptr_t)0x7fff8000) sometimes also works. */
860 # define OS_TYPE "ULTRIX"
864 # define OS_TYPE "RISCOS"
865 # define ALIGNMENT 4 /* Required by hardware */
868 # define OS_TYPE "IRIX5"
869 # define MPROTECT_VDB
871 # define CPP_WORDSZ _MIPS_SZPTR
872 # define ALIGNMENT (_MIPS_SZPTR/8)
873 # if CPP_WORDSZ != 64
874 # define ALIGN_DOUBLE
878 # define ALIGN_DOUBLE
880 # define DYNAMIC_LOADING
885 # define MACH_TYPE "RS6000"
887 # define DATASTART ((ptr_t)0x20000000)
889 # define STACKBOTTOM ((ptr_t)((ulong)&errno))
890 # define DYNAMIC_LOADING
891 /* For really old versions of AIX, this may have to be removed. */
895 # define MACH_TYPE "HP_PA"
897 # define ALIGN_DOUBLE
898 extern int __data_start;
899 # define DATASTART ((ptr_t)(&__data_start))
901 /* The following appears to work for 7xx systems running HP/UX */
902 /* 9.xx Furthermore, it might result in much faster */
903 /* collections than HEURISTIC2, which may involve scanning */
904 /* segments that directly precede the stack. It is not the */
905 /* default, since it may not work on older machine/OS */
906 /* combinations. (Thanks to Raymond X.T. Nijssen for uncovering */
908 # define STACKBOTTOM ((ptr_t) 0x7b033000) /* from /etc/conf/h/param.h */
912 # define STACK_GROWS_UP
913 # define DYNAMIC_LOADING
915 # define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
916 /* They misspelled the Posix macro? */
920 # define MACH_TYPE "ALPHA"
923 # define OS_TYPE "OSF1"
924 # define DATASTART ((ptr_t) 0x140000000)
926 # define DATAEND ((ptr_t) &_end)
928 /* Normally HEURISTIC2 is too conervative, since */
929 /* the text segment immediately follows the stack. */
930 /* Hence we give an upper pound. */
932 # define HEURISTIC2_LIMIT ((ptr_t)((word)(&__start) & ~(getpagesize()-1)))
933 # define CPP_WORDSZ 64
934 # define MPROTECT_VDB
935 # define DYNAMIC_LOADING
938 # define OS_TYPE "LINUX"
939 # define CPP_WORDSZ 64
940 # define STACKBOTTOM ((ptr_t) 0x120000000)
943 /* __data_start apparently disappeared in some recent releases. */
944 extern int __data_start;
945 # define DATASTART &__data_start
947 # define DATASTART GC_data_start
948 # define DYNAMIC_LOADING
950 # define DATASTART ((ptr_t) 0x140000000)
953 # define DATAEND (&_end)
954 # define MPROTECT_VDB
955 /* Has only been superficially tested. May not */
956 /* work on all versions. */
961 # define MACH_TYPE "M88K"
963 # define ALIGN_DOUBLE
966 # define OS_TYPE "CX_UX"
967 # define DATASTART ((((word)&etext + 0x3fffff) & ~0x3fffff) + 0x10000)
970 # define OS_TYPE "DGUX"
971 extern char * GC_SysVGetDataStart();
972 # define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &etext)
974 # define STACKBOTTOM ((char*)0xf0000000) /* determined empirically */
978 # define MACH_TYPE "S370"
979 # define OS_TYPE "UTS4"
980 # define ALIGNMENT 4 /* Required by hardware */
984 extern char * GC_SysVGetDataStart();
985 # define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
986 # define DATAEND (&_end)
990 # ifndef STACK_GROWS_UP
991 # define STACK_GROWS_DOWN
995 # define CPP_WORDSZ 32
1004 # define DATAEND (&end)
1007 # if defined(SVR4) && !defined(GETPAGESIZE)
1008 # include <unistd.h>
1009 # define GETPAGESIZE() sysconf(_SC_PAGESIZE)
1012 # ifndef GETPAGESIZE
1013 # if defined(SUNOS5) || defined(IRIX5)
1014 # include <unistd.h>
1016 # define GETPAGESIZE() getpagesize()
1019 # if defined(SUNOS5) || defined(DRSNX) || defined(UTS4)
1020 /* OS has SVR4 generic features. Probably others also qualify. */
1024 # if defined(SUNOS5) || defined(DRSNX)
1025 /* OS has SUNOS5 style semi-undocumented interface to dynamic */
1028 /* OS has SUNOS5 style signal handlers. */
1032 # if CPP_WORDSZ != 32 && CPP_WORDSZ != 64
1037 # undef DYNAMIC_LOADING
1042 # undef MPROTECT_VDB
1047 /* Postponed for now. */
1049 # undef MPROTECT_VDB
1052 # ifdef SMALL_CONFIG
1053 /* Presumably not worth the space it takes. */
1055 # undef MPROTECT_VDB
1059 # undef MPROTECT_VDB /* Can't deal with address space holes. */
1062 # if !defined(PCR_VDB) && !defined(PROC_VDB) && !defined(MPROTECT_VDB)
1063 # define DEFAULT_VDB
1066 # if defined(_SOLARIS_PTHREADS) && !defined(SOLARIS_THREADS)
1067 # define SOLARIS_THREADS
1069 # if defined(IRIX_THREADS) && !defined(IRIX5)
1070 --> inconsistent configuration
1072 # if defined(IRIX_JDK_THREADS) && !defined(IRIX5)
1073 --> inconsistent configuration
1075 # if defined(LINUX_THREADS) && !defined(LINUX)
1076 --> inconsistent configuration
1078 # if defined(SOLARIS_THREADS) && !defined(SUNOS5)
1079 --> inconsistent configuration
1081 # if defined(PCR) || defined(SRC_M3) || \
1082 defined(SOLARIS_THREADS) || defined(WIN32_THREADS) || \
1083 defined(IRIX_THREADS) || defined(LINUX_THREADS) || \
1084 defined(IRIX_JDK_THREADS)
1088 # if defined(HP_PA) || defined(M88K) || defined(POWERPC) \
1089 || (defined(I386) && defined(OS2)) || defined(UTS4) || defined(LINT)
1090 /* Use setjmp based hack to mark from callee-save registers. */
1091 # define USE_GENERIC_PUSH_REGS
1093 # if defined(SPARC) && !defined(LINUX)
1094 # define SAVE_CALL_CHAIN
1095 # define ASM_CLEAR_CODE /* Stack clearing is crucial, and we */
1096 /* include assembly code to do it well. */