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
56 # if defined(__NetBSD__) && defined(arm32)
59 # define mach_type_known
68 # define mach_type_known
70 # if defined(mips) || defined(__mips)
72 # if defined(ultrix) || defined(__ultrix) || defined(__NetBSD__)
75 # if defined(_SYSTYPE_SVR4) || defined(SYSTYPE_SVR4) || defined(__SYSTYPE_SVR4__)
76 # define IRIX5 /* or IRIX 6.X */
78 # define RISCOS /* or IRIX 4.X */
81 # define mach_type_known
83 # if defined(sequent) && defined(i386)
86 # define mach_type_known
88 # if defined(sun) && defined(i386)
91 # define mach_type_known
93 # if (defined(__OS2__) || defined(__EMX__)) && defined(__32BIT__)
96 # define mach_type_known
100 # define mach_type_known
102 # if defined(sun) && (defined(sparc) || defined(__sparc))
104 /* Test for SunOS 5.x */
111 # define mach_type_known
113 # if defined(sparc) && defined(unix) && !defined(sun) && !defined(linux) \
114 && !defined(__OpenBSD__)
117 # define mach_type_known
121 # define mach_type_known
123 # if defined(_M_XENIX) && defined(_M_SYSV) && defined(_M_I386)
124 /* The above test may need refinement */
126 # if defined(_SCO_ELF)
131 # define mach_type_known
133 # if defined(_AUX_SOURCE)
136 # define mach_type_known
138 # if defined(_PA_RISC1_0) || defined(_PA_RISC1_1) || defined(_PA_RISC2_0) \
139 || defined(hppa) || defined(__hppa__)
144 # define mach_type_known
146 # if defined(LINUX) && (defined(i386) || defined(__i386__))
148 # define mach_type_known
150 # if defined(LINUX) && (defined(__ia64__) || defined(__ia64))
152 # define mach_type_known
154 # if defined(LINUX) && defined(powerpc)
156 # define mach_type_known
158 # if defined(LINUX) && defined(__mc68000__)
160 # define mach_type_known
162 # if defined(LINUX) && defined(sparc)
164 # define mach_type_known
166 # if defined(__alpha) || defined(__alpha__)
169 # define OSF1 /* a.k.a Digital Unix */
171 # define mach_type_known
173 # if defined(_AMIGA) && !defined(AMIGA)
178 # define mach_type_known
180 # if defined(THINK_C) || defined(__MWERKS__) && !defined(__powerc)
183 # define mach_type_known
185 # if defined(__MWERKS__) && defined(__powerc)
188 # define mach_type_known
193 # define mach_type_known
195 # if defined(NeXT) && defined(mc68000)
198 # define mach_type_known
200 # if defined(NeXT) && defined(i386)
203 # define mach_type_known
205 # if defined(__OpenBSD__) && defined(i386)
208 # define mach_type_known
210 # if defined(__FreeBSD__) && defined(i386)
213 # define mach_type_known
215 # if defined(__NetBSD__) && defined(i386)
218 # define mach_type_known
220 # if defined(bsdi) && defined(i386)
223 # define mach_type_known
225 # if !defined(mach_type_known) && defined(__386BSD__)
228 # define mach_type_known
230 # if defined(_CX_UX) && defined(_M88K)
233 # define mach_type_known
238 # define mach_type_known
240 # if (defined(_MSDOS) || defined(_MSC_VER)) && (_M_IX86 >= 300) \
241 || defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__)
243 # define MSWIN32 /* or Win32s */
244 # define mach_type_known
246 # if defined(__DJGPP__)
249 # define DJGPP /* MSDOS running the DJGPP port of GCC */
251 # define mach_type_known
253 # if defined(__CYGWIN32__) || defined(__CYGWIN__)
256 # define mach_type_known
258 # if defined(__BORLANDC__)
261 # define mach_type_known
263 # if defined(_UTS) && !defined(mach_type_known)
266 # define mach_type_known
270 # define mach_type_known
273 # if defined(__WATCOMC__) && defined(__386__)
275 # if !defined(OS2) && !defined(MSWIN32) && !defined(DOS4GW)
276 # if defined(__OS2__)
279 # if defined(__WINDOWS_386__) || defined(__NT__)
286 # define mach_type_known
289 /* Feel free to add more clauses here */
291 /* Or manually define the machine type here. A machine type is */
292 /* characterized by the architecture. Some */
293 /* machine types are further subdivided by OS. */
294 /* the macros ULTRIX, RISCOS, and BSD to distinguish. */
295 /* Note that SGI IRIX is treated identically to RISCOS. */
296 /* SYSV on an M68K actually means A/UX. */
297 /* The distinction in these cases is usually the stack starting address */
298 # ifndef mach_type_known
299 --> unknown machine type
301 /* Mapping is: M68K ==> Motorola 680X0 */
302 /* (SUNOS4,HP,NEXT, and SYSV (A/UX), */
303 /* MACOS and AMIGA variants) */
304 /* I386 ==> Intel 386 */
305 /* (SEQUENT, OS2, SCO, LINUX, NETBSD, */
306 /* FREEBSD, THREE86BSD, MSWIN32, */
307 /* BSDI,SUNOS5, NEXT, other variants) */
308 /* NS32K ==> Encore Multimax */
309 /* MIPS ==> R2000 or R3000 */
310 /* (RISCOS, ULTRIX variants) */
311 /* VAX ==> DEC VAX */
312 /* (BSD, ULTRIX variants) */
313 /* RS6000 ==> IBM RS/6000 AIX3.X */
314 /* RT ==> IBM PC/RT */
315 /* HP_PA ==> HP9000/700 & /800 */
317 /* SPARC ==> SPARC under SunOS */
318 /* (SUNOS4, SUNOS5, */
319 /* DRSNX variants) */
320 /* ALPHA ==> DEC Alpha */
321 /* (OSF1 and LINUX variants) */
322 /* M88K ==> Motorola 88XX0 */
323 /* (CX_UX and DGUX) */
324 /* S370 ==> 370-like machine */
325 /* running Amdahl UTS4 */
329 * For each architecture and OS, the following need to be defined:
331 * CPP_WORD_SZ is a simple integer constant representing the word size.
332 * in bits. We assume byte addressibility, where a byte has 8 bits.
333 * We also assume CPP_WORD_SZ is either 32 or 64.
334 * (We care about the length of pointers, not hardware
335 * bus widths. Thus a 64 bit processor with a C compiler that uses
336 * 32 bit pointers should use CPP_WORD_SZ of 32, not 64. Default is 32.)
338 * MACH_TYPE is a string representation of the machine type.
339 * OS_TYPE is analogous for the OS.
341 * ALIGNMENT is the largest N, such that
342 * all pointer are guaranteed to be aligned on N byte boundaries.
343 * defining it to be 1 will always work, but perform poorly.
345 * DATASTART is the beginning of the data segment.
346 * On UNIX systems, the collector will scan the area between DATASTART
347 * and DATAEND for root pointers.
349 * DATAEND, if not &end.
351 * ALIGN_DOUBLE of GC_malloc should return blocks aligned to twice
354 * STACKBOTTOM is the cool end of the stack, which is usually the
355 * highest address in the stack.
356 * Under PCR or OS/2, we have other ways of finding thread stacks.
357 * For each machine, the following should:
358 * 1) define STACK_GROWS_UP if the stack grows toward higher addresses, and
359 * 2) define exactly one of
360 * STACKBOTTOM (should be defined to be an expression)
363 * If either of the last two macros are defined, then STACKBOTTOM is computed
364 * during collector startup using one of the following two heuristics:
365 * HEURISTIC1: Take an address inside GC_init's frame, and round it up to
366 * the next multiple of STACK_GRAN.
367 * HEURISTIC2: Take an address inside GC_init's frame, increment it repeatedly
368 * in small steps (decrement if STACK_GROWS_UP), and read the value
369 * at each location. Remember the value when the first
370 * Segmentation violation or Bus error is signalled. Round that
371 * to the nearest plausible page boundary, and use that instead
374 * If no expression for STACKBOTTOM can be found, and neither of the above
375 * heuristics are usable, the collector can still be used with all of the above
376 * undefined, provided one of the following is done:
377 * 1) GC_mark_roots can be changed to somehow mark from the correct stack(s)
378 * without reference to STACKBOTTOM. This is appropriate for use in
379 * conjunction with thread packages, since there will be multiple stacks.
380 * (Allocating thread stacks in the heap, and treating them as ordinary
381 * heap data objects is also possible as a last resort. However, this is
382 * likely to introduce significant amounts of excess storage retention
383 * unless the dead parts of the thread stacks are periodically cleared.)
384 * 2) Client code may set GC_stackbottom before calling any GC_ routines.
385 * If the author of the client code controls the main program, this is
386 * easily accomplished by introducing a new main program, setting
387 * GC_stackbottom to the address of a local variable, and then calling
388 * the original main program. The new main program would read something
391 * # include "gc_private.h"
393 * main(argc, argv, envp)
395 * char **argv, **envp;
399 * GC_stackbottom = (ptr_t)(&dummy);
400 * return(real_main(argc, argv, envp));
404 * Each architecture may also define the style of virtual dirty bit
405 * implementation to be used:
406 * MPROTECT_VDB: Write protect the heap and catch faults.
407 * PROC_VDB: Use the SVR4 /proc primitives to read dirty bits.
409 * An architecture may define DYNAMIC_LOADING if dynamic_load.c
410 * defined GC_register_dynamic_libraries() for the architecture.
414 # define STACK_GRAN 0x1000000
416 # define MACH_TYPE "M68K"
419 # define OS_TYPE "OPENBSD"
422 # define DATASTART ((ptr_t)(&etext))
425 # define OS_TYPE "NETBSD"
428 # define DATASTART ((ptr_t)(&etext))
431 # define OS_TYPE "LINUX"
432 # define STACKBOTTOM ((ptr_t)0xf0000000)
433 # define MPROTECT_VDB
435 # define DYNAMIC_LOADING
436 extern char **__environ
;
437 # define DATASTART ((ptr_t)(&__environ))
438 /* hideous kludge: __environ is the first */
439 /* word in crt0.o, and delimits the start */
440 /* of the data segment, no matter which */
441 /* ld options were passed through. */
442 /* We could use _etext instead, but that */
443 /* would include .rodata, which may */
444 /* contain large read-only data tables */
445 /* that we'd rather not scan. */
447 # define DATAEND (&_end)
450 # define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
454 # define OS_TYPE "SUNOS4"
456 # define DATASTART ((ptr_t)((((word) (&etext)) + 0x1ffff) & ~0x1ffff))
457 # define HEURISTIC1 /* differs */
458 # define DYNAMIC_LOADING
461 # define OS_TYPE "HP"
463 # define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
464 # define STACKBOTTOM ((ptr_t) 0xffeffffc)
465 /* empirically determined. seems to work. */
467 # define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
470 # define OS_TYPE "SYSV"
472 # define DATASTART ((ptr_t)((((word) (&etext)) + 0x3fffff) \
474 +((word)&etext & 0x1fff))
475 /* This only works for shared-text binaries with magic number 0413.
476 The other sorts of SysV binaries put the data at the end of the text,
477 in which case the default of &etext would work. Unfortunately,
478 handling both would require having the magic-number available.
481 # define STACKBOTTOM ((ptr_t)0xFFFFFFFE)
482 /* The stack starts at the top of memory, but */
483 /* 0x0 cannot be used as setjump_test complains */
484 /* that the stack direction is incorrect. Two */
485 /* bytes down from 0x0 should be safe enough. */
487 # include <sys/mmu.h>
488 # define GETPAGESIZE() PAGESIZE /* Is this still right? */
491 # define OS_TYPE "AMIGA"
492 /* STACKBOTTOM and DATASTART handled specially */
494 # define DATAEND /* not needed */
495 # define GETPAGESIZE() 4096
501 # define OS_TYPE "MACOS"
502 /* see os_dep.c for details of global data segments. */
503 # define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
504 # define DATAEND /* not needed */
505 # define GETPAGESIZE() 4096
508 # define OS_TYPE "NEXT"
509 # define DATASTART ((ptr_t) get_etext())
510 # define STACKBOTTOM ((ptr_t) 0x4000000)
511 # define DATAEND /* not needed */
516 # define MACH_TYPE "POWERPC"
518 # define ALIGNMENT 2 /* Still necessary? Could it be 4? */
522 # define OS_TYPE "MACOS"
523 /* see os_dep.c for details of global data segments. */
524 # define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
525 # define DATAEND /* not needed */
528 # define ALIGNMENT 4 /* Guess. Can someone verify? */
529 /* This was 2, but that didn't sound right. */
530 # define OS_TYPE "LINUX"
533 # define STACK_GRAN 0x10000000
534 /* Stack usually starts at 0x80000000 */
535 extern int data_start
;
536 # define DATASTART (&data_start)
538 # define DATAEND (&_end)
539 # define DYNAMIC_LOADING
543 # define OS_TYPE "MACOSX"
544 # define DATASTART ((ptr_t) get_etext())
545 # define STACKBOTTOM ((ptr_t) 0xc0000000)
546 # define DATAEND /* not needed */
551 # define MACH_TYPE "VAX"
552 # define ALIGNMENT 4 /* Pointers are longword aligned by 4.2 C compiler */
554 # define DATASTART ((ptr_t)(&etext))
556 # define OS_TYPE "BSD"
558 /* HEURISTIC2 may be OK, but it's hard to test. */
561 # define OS_TYPE "ULTRIX"
562 # define STACKBOTTOM ((ptr_t) 0x7fffc800)
567 # define MACH_TYPE "RT"
569 # define DATASTART ((ptr_t) 0x10000000)
570 # define STACKBOTTOM ((ptr_t) 0x1fffd800)
574 # define MACH_TYPE "SPARC"
575 # define ALIGNMENT 4 /* Required by hardware */
576 # define ALIGN_DOUBLE
579 # define OS_TYPE "SUNOS5"
582 extern char * GC_SysVGetDataStart();
583 # define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
584 # define DATAEND (&_end)
589 # define HEAP_START (ptr_t)0x40000000
591 # define HEAP_START DATAEND
594 /* HEURISTIC1 reportedly no longer works under 2.7. Thus we */
595 /* switched to HEURISTIC2, eventhough it creates some debugging */
599 # define GETPAGESIZE() sysconf(_SC_PAGESIZE)
600 /* getpagesize() appeared to be missing from at least one */
601 /* Solaris 5.4 installation. Weird. */
602 # define DYNAMIC_LOADING
605 # define OS_TYPE "SUNOS4"
606 /* [If you have a weak stomach, don't read this.] */
607 /* We would like to use: */
608 /* # define DATASTART ((ptr_t)((((word) (&etext)) + 0x1fff) & ~0x1fff)) */
609 /* This fails occasionally, due to an ancient, but very */
610 /* persistent ld bug. &etext is set 32 bytes too high. */
611 /* We instead read the text segment size from the a.out */
612 /* header, which happens to be mapped into our address space */
613 /* at the start of the text segment. The detective work here */
614 /* was done by Robert Ehrlich, Manuel Serrano, and Bernard */
615 /* Serpette of INRIA. */
616 /* This assumes ZMAGIC, i.e. demand-loadable executables. */
617 # define TEXTSTART 0x2000
618 # define DATASTART ((ptr_t)(*(int *)(TEXTSTART+0x4)+TEXTSTART))
619 # define MPROTECT_VDB
621 # define DYNAMIC_LOADING
624 # define CPP_WORDSZ 32
625 # define OS_TYPE "DRSNX"
626 extern char * GC_SysVGetDataStart();
628 # define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &etext)
629 # define MPROTECT_VDB
630 # define STACKBOTTOM ((ptr_t) 0xdfff0000)
631 # define DYNAMIC_LOADING
634 # define OS_TYPE "LINUX"
636 # define DATASTART GC_data_start
637 # define DYNAMIC_LOADING
639 Linux Sparc non elf
?
642 # define DATAEND (&_end)
644 # define STACKBOTTOM ((ptr_t) 0xf0000000)
647 # define OS_TYPE "OPENBSD"
648 # define STACKBOTTOM ((ptr_t) 0xf8000000)
649 # define DATASTART ((ptr_t)(&etext))
654 # define MACH_TYPE "I386"
655 # define ALIGNMENT 4 /* Appears to hold for all "32 bit" compilers */
656 /* except Borland. The -a4 option fixes */
658 /* Ivan Demakov: For Watcom the option is -zp4. */
659 # ifndef SMALL_CONFIG
660 # define ALIGN_DOUBLE /* Not strictly necessary, but may give speed */
661 /* improvement on Pentiums. */
664 # define OS_TYPE "SEQUENT"
666 # define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
667 # define STACKBOTTOM ((ptr_t) 0x3ffff000)
670 # define OS_TYPE "SUNOS5"
671 extern int etext
, _start
;
672 extern char * GC_SysVGetDataStart();
673 # define DATASTART GC_SysVGetDataStart(0x1000, &etext)
674 # define STACKBOTTOM ((ptr_t)(&_start))
675 /** At least in Solaris 2.5, PROC_VDB gives wrong values for dirty bits. */
676 /*# define PROC_VDB*/
677 # define DYNAMIC_LOADING
682 # define HEAP_START (ptr_t)0x40000000
684 # define HEAP_START DATAEND
688 # define OS_TYPE "SCO"
690 # define DATASTART ((ptr_t)((((word) (&etext)) + 0x3fffff) \
692 +((word)&etext & 0xfff))
693 # define STACKBOTTOM ((ptr_t) 0x7ffffffc)
696 # define OS_TYPE "SCO_ELF"
698 # define DATASTART ((ptr_t)(&etext))
699 # define STACKBOTTOM ((ptr_t) 0x08048000)
700 # define DYNAMIC_LOADING
701 # define ELF_CLASS ELFCLASS32
704 # define OS_TYPE "LINUX"
707 # define STACK_GRAN 0x10000000
708 /* STACKBOTTOM is usually 0xc0000000, but this changes with */
709 /* different kernel configurations. In particular, systems */
710 /* with 2GB physical memory will usually move the user */
711 /* address space limit, and hence initial SP to 0x80000000. */
712 # if !defined(LINUX_THREADS) || !defined(REDIRECT_MALLOC)
713 /* libgcj: Linux threads don't interact well with the read() wrapper.
714 Not defining MPROTECT_VDB fixes this. */
715 /* # define MPROTECT_VDB */
717 /* We seem to get random errors in incremental mode, */
718 /* possibly because Linux threads is itself a malloc client */
719 /* and can't deal with the signals. */
722 # define DYNAMIC_LOADING
723 # ifdef UNDEFINED /* includes ro data */
725 # define DATASTART ((ptr_t)((((word) (&_etext)) + 0xfff) & ~0xfff))
727 # include <features.h>
728 # if defined(__GLIBC__) && __GLIBC__ >= 2
729 extern int __data_start
;
730 # define DATASTART ((ptr_t)(&__data_start))
732 extern char **__environ
;
733 # define DATASTART ((ptr_t)(&__environ))
734 /* hideous kludge: __environ is the first */
735 /* word in crt0.o, and delimits the start */
736 /* of the data segment, no matter which */
737 /* ld options were passed through. */
738 /* We could use _etext instead, but that */
739 /* would include .rodata, which may */
740 /* contain large read-only data tables */
741 /* that we'd rather not scan. */
744 # define DATAEND (&_end)
747 # define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
751 # define OS_TYPE "CYGWIN32"
752 extern int _data_start__
;
753 extern int _data_end__
;
754 extern int _bss_start__
;
755 extern int _bss_end__
;
756 /* For binutils 2.9.1, we have */
757 /* DATASTART = _data_start__ */
758 /* DATAEND = _bss_end__ */
759 /* whereas for some earlier versions it was */
760 /* DATASTART = _bss_start__ */
761 /* DATAEND = _data_end__ */
762 /* To get it right for both, we take the */
763 /* minumum/maximum of the two. */
764 # define MAX(x,y) ((x) > (y) ? (x) : (y))
765 # define MIN(x,y) ((x) < (y) ? (x) : (y))
766 # define DATASTART ((ptr_t) MIN(&_data_start__, &_bss_start__))
767 # define DATAEND ((ptr_t) MAX(&_data_end__, &_bss_end__))
769 # define STACK_GRAN 0x10000
773 # define OS_TYPE "OS2"
774 /* STACKBOTTOM and DATASTART are handled specially in */
775 /* os_dep.c. OS2 actually has the right */
777 # define DATAEND /* not needed */
780 # define OS_TYPE "MSWIN32"
781 /* STACKBOTTOM and DATASTART are handled specially in */
784 # define MPROTECT_VDB
786 # define DATAEND /* not needed */
789 # define OS_TYPE "DJGPP"
790 # include "stubinfo.h"
793 extern int __djgpp_stack_limit
;
794 # define DATASTART ((ptr_t)((((word) (&etext)) + 0x1ff) & ~0x1ff))
795 /* # define STACKBOTTOM ((ptr_t)((word) _stubinfo + _stubinfo->size \
797 # define STACKBOTTOM ((ptr_t)((word) __djgpp_stack_limit + _stklen))
798 /* This may not be right. */
801 # define OS_TYPE "OPENBSD"
804 # define OS_TYPE "FREEBSD"
805 # define MPROTECT_VDB
808 # define OS_TYPE "NETBSD"
811 # define OS_TYPE "THREE86BSD"
814 # define OS_TYPE "BSDI"
816 # if defined(OPENBSD) || defined(FREEBSD) || defined(NETBSD) \
817 || defined(THREE86BSD) || defined(BSDI)
820 # define DATASTART ((ptr_t)(&etext))
823 # define OS_TYPE "NEXT"
824 # define DATASTART ((ptr_t) get_etext())
825 # define STACKBOTTOM ((ptr_t)0xc0000000)
826 # define DATAEND /* not needed */
829 # define OS_TYPE "DOS4GW"
830 extern long __nullarea
;
832 extern char *_STACKTOP
;
833 /* Depending on calling conventions Watcom C either precedes
834 or does not precedes with undescore names of C-variables.
835 Make sure startup code variables always have the same names. */
836 #pragma aux __nullarea "*";
837 #pragma aux _end "*";
838 # define STACKBOTTOM ((ptr_t) _STACKTOP)
839 /* confused? me too. */
840 # define DATASTART ((ptr_t) &__nullarea)
841 # define DATAEND ((ptr_t) &_end)
846 # define MACH_TYPE "NS32K"
848 extern char **environ
;
849 # define DATASTART ((ptr_t)(&environ))
850 /* hideous kludge: environ is the first */
851 /* word in crt0.o, and delimits the start */
852 /* of the data segment, no matter which */
853 /* ld options were passed through. */
854 # define STACKBOTTOM ((ptr_t) 0xfffff000) /* for Encore */
859 # define MACH_TYPE "MIPS"
860 /* LIBGCJ LOCAL: respect predefined DATASTART_IS_ETEXT. */
861 # ifdef DATASTART_IS_ETEXT
863 # define DATASTART ((ptr_t)(&_etext))
866 # define DATASTART (ptr_t)0x10000000
867 /* Could probably be slightly higher since */
868 /* startup code allocates lots of stuff. */
871 # define DATASTART ((ptr_t)(&_fdata))
873 # define HEAP_START (ptr_t)0x30000000
875 # define HEAP_START DATASTART
877 /* Lowest plausible heap address. */
878 /* In the MMAP case, we map there. */
879 /* In either case it is used to identify */
880 /* heap sections so they're not */
881 /* considered as roots. */
883 # endif /* DATASTART_IS_ETEXT */
885 /* # define STACKBOTTOM ((ptr_t)0x7fff8000) sometimes also works. */
887 # define OS_TYPE "ULTRIX"
891 # define OS_TYPE "RISCOS"
892 # define ALIGNMENT 4 /* Required by hardware */
895 # define OS_TYPE "IRIX5"
896 # define MPROTECT_VDB
898 # define CPP_WORDSZ _MIPS_SZPTR
899 # define ALIGNMENT (_MIPS_SZPTR/8)
900 # if CPP_WORDSZ != 64
901 # define ALIGN_DOUBLE
905 # define ALIGN_DOUBLE
907 # define DYNAMIC_LOADING
911 extern char __ram_data_start
;
912 extern char __ram_data_end
;
913 # define MACH_TYPE "MIPS"
914 # define DATASTART (ptr_t)(&__ram_data_start)
915 # define DATAEND (ptr_t)(&__ram_data_end)
919 # define ALIGN_DOUBLE
924 # define MACH_TYPE "RS6000"
926 # define DATASTART ((ptr_t)0x20000000)
928 # define STACKBOTTOM ((ptr_t)((ulong)&errno))
929 # define DYNAMIC_LOADING
930 /* For really old versions of AIX, this may have to be removed. */
934 /* OS is assumed to be HP/UX */
935 # define MACH_TYPE "HP_PA"
936 # define OS_TYPE "HPUX"
938 # define CPP_WORDSZ 64
941 # define CPP_WORDSZ 32
943 # define ALIGN_DOUBLE
945 extern int __data_start
;
946 # define DATASTART ((ptr_t)(&__data_start))
948 /* The following appears to work for 7xx systems running HP/UX */
949 /* 9.xx Furthermore, it might result in much faster */
950 /* collections than HEURISTIC2, which may involve scanning */
951 /* segments that directly precede the stack. It is not the */
952 /* default, since it may not work on older machine/OS */
953 /* combinations. (Thanks to Raymond X.T. Nijssen for uncovering */
955 # define STACKBOTTOM ((ptr_t) 0x7b033000) /* from /etc/conf/h/param.h */
959 # define STACK_GROWS_UP
960 # define DYNAMIC_LOADING
961 # ifndef HPUX_THREADS
962 # define MPROTECT_VDB
965 # define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
966 /* They misspelled the Posix macro? */
970 # define MACH_TYPE "ALPHA"
973 # define OS_TYPE "OSF1"
974 # define DATASTART ((ptr_t) 0x140000000)
976 # define DATAEND ((ptr_t) &_end)
978 /* Normally HEURISTIC2 is too conervative, since */
979 /* the text segment immediately follows the stack. */
980 /* Hence we give an upper pound. */
982 # define HEURISTIC2_LIMIT ((ptr_t)((word)(&__start) & ~(getpagesize()-1)))
983 # define CPP_WORDSZ 64
984 # define MPROTECT_VDB
985 # define DYNAMIC_LOADING
988 # define OS_TYPE "LINUX"
989 # define CPP_WORDSZ 64
990 # define STACKBOTTOM ((ptr_t) 0x120000000)
992 /* glibc for Linux/Alpha no longer provides a symbol marking
993 the start of the data segment. So libgcj defines
994 data_start on its own (in libgcjdata.a). */
995 extern int data_start
;
996 # define DATASTART &data_start
997 # define DYNAMIC_LOADING
999 # define DATASTART ((ptr_t) 0x140000000)
1002 # define DATAEND (&_end)
1003 # undef MPROTECT_VDB
1004 /* Has only been superficially tested. May not */
1005 /* work on all versions. */
1010 # define MACH_TYPE "IA64"
1011 # define ALIGN_DOUBLE
1012 /* Requires 16 byte alignment for malloc */
1013 # define ALIGNMENT 8
1018 # define OS_TYPE "LINUX"
1019 # define CPP_WORDSZ 64
1020 /* This should really be done through /proc, but that */
1021 /* requires we run on an IA64 kernel. */
1022 # define STACKBOTTOM ((ptr_t) 0xa000000000000000l)
1023 /* We also need the base address of the register stack */
1024 /* backing store. There is probably a better way to */
1025 /* get that, too ... */
1026 # define BACKING_STORE_BASE ((ptr_t) 0x9fffffff80000000l)
1027 # define DATASTART GC_data_start
1028 # define DYNAMIC_LOADING
1030 # define DATAEND (&_end)
1035 # define MACH_TYPE "M88K"
1036 # define ALIGNMENT 4
1037 # define ALIGN_DOUBLE
1040 # define OS_TYPE "CX_UX"
1041 # define DATASTART ((((word)&etext + 0x3fffff) & ~0x3fffff) + 0x10000)
1044 # define OS_TYPE "DGUX"
1045 extern char * GC_SysVGetDataStart();
1046 # define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &etext)
1048 # define STACKBOTTOM ((char*)0xf0000000) /* determined empirically */
1052 # define MACH_TYPE "S370"
1053 # define OS_TYPE "UTS4"
1054 # define ALIGNMENT 4 /* Required by hardware */
1058 extern char * GC_SysVGetDataStart();
1059 # define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
1060 # define DATAEND (&_end)
1065 # define ALIGNMENT 4
1067 # define DATASTART ((ptr_t)(&_etext))
1072 # define CPP_WORDSZ 32
1073 # define MACH_TYPE "ARM32"
1074 # define ALIGNMENT 4
1076 # define OS_TYPE "NETBSD"
1079 # define DATASTART ((ptr_t)(&etext))
1080 # define USE_GENERIC_PUSH_REGS
1084 # ifndef STACK_GROWS_UP
1085 # define STACK_GROWS_DOWN
1089 # define CPP_WORDSZ 32
1098 # define DATAEND (&end)
1101 # if defined(SVR4) && !defined(GETPAGESIZE)
1102 # include <unistd.h>
1103 # define GETPAGESIZE() sysconf(_SC_PAGESIZE)
1106 # ifndef GETPAGESIZE
1107 # if defined(SUNOS5) || defined(IRIX5)
1108 # include <unistd.h>
1110 # define GETPAGESIZE() getpagesize()
1113 # if defined(SUNOS5) || defined(DRSNX) || defined(UTS4)
1114 /* OS has SVR4 generic features. Probably others also qualify. */
1118 # if defined(SUNOS5) || defined(DRSNX)
1119 /* OS has SUNOS5 style semi-undocumented interface to dynamic */
1122 /* OS has SUNOS5 style signal handlers. */
1130 # if CPP_WORDSZ != 32 && CPP_WORDSZ != 64
1135 # undef DYNAMIC_LOADING
1140 # undef MPROTECT_VDB
1145 /* Postponed for now. */
1147 # undef MPROTECT_VDB
1150 # ifdef SMALL_CONFIG
1151 /* Presumably not worth the space it takes. */
1153 # undef MPROTECT_VDB
1157 # undef MPROTECT_VDB /* Can't deal with address space holes. */
1160 # if !defined(PCR_VDB) && !defined(PROC_VDB) && !defined(MPROTECT_VDB)
1161 # define DEFAULT_VDB
1164 # if defined(_SOLARIS_PTHREADS) && !defined(SOLARIS_THREADS)
1165 # define SOLARIS_THREADS
1167 # if defined(IRIX_THREADS) && !defined(IRIX5)
1168 --> inconsistent configuration
1170 # if defined(IRIX_JDK_THREADS) && !defined(IRIX5)
1171 --> inconsistent configuration
1173 # if defined(LINUX_THREADS) && !defined(LINUX)
1174 --> inconsistent configuration
1176 # if defined(SOLARIS_THREADS) && !defined(SUNOS5)
1177 --> inconsistent configuration
1179 # if defined(HPUX_THREADS) && !defined(HPUX)
1180 --> inconsistent configuration
1182 # if defined(PCR) || defined(SRC_M3) || \
1183 defined(SOLARIS_THREADS) || defined(WIN32_THREADS) || \
1184 defined(IRIX_THREADS) || defined(LINUX_THREADS) || \
1185 defined(IRIX_JDK_THREADS) || defined(HPUX_THREADS)
1189 # if defined(HP_PA) || defined(M88K) || defined(POWERPC) \
1190 || (defined(I386) && defined(OS2)) || defined(UTS4) || defined(LINT)
1191 /* Use setjmp based hack to mark from callee-save registers. */
1192 # define USE_GENERIC_PUSH_REGS
1194 # if defined(SPARC) && !defined(LINUX)
1195 # define SAVE_CALL_CHAIN
1196 # define ASM_CLEAR_CODE /* Stack clearing is crucial, and we */
1197 /* include assembly code to do it well. */