OSDN Git Service

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