OSDN Git Service

This commit was generated by cvs2svn to compensate for changes in r33244,
[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  *
6  * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
7  * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
8  *
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.
14  */
15  
16 #ifndef GCCONFIG_H
17
18 # define GCCONFIG_H
19
20 /* Machine dependent parameters.  Some tuning parameters can be found   */
21 /* near the top of gc_private.h.                                        */
22
23 /* Machine specific parts contributed by various people.  See README file. */
24
25 /* First a unified test for Linux: */
26 # if defined(linux) || defined(__linux__)
27 #    define LINUX
28 # endif
29
30 /* Determine the machine type: */
31 # if defined(sun) && defined(mc68000)
32 #    define M68K
33 #    define SUNOS4
34 #    define mach_type_known
35 # endif
36 # if defined(hp9000s300)
37 #    define M68K
38 #    define HP
39 #    define mach_type_known
40 # endif
41 # if defined(__OpenBSD__) && defined(m68k)
42 #    define M68K
43 #    define OPENBSD
44 #    define mach_type_known
45 # endif
46 # if defined(__OpenBSD__) && defined(__sparc__)
47 #    define SPARC
48 #    define OPENBSD
49 #    define mach_type_known
50 # endif
51 # if defined(__NetBSD__) && defined(m68k)
52 #    define M68K
53 #    define NETBSD
54 #    define mach_type_known
55 # endif
56 # if defined(__NetBSD__) && defined(arm32)
57 #    define ARM32
58 #    define NETBSD
59 #    define mach_type_known
60 # endif
61 # if defined(vax)
62 #    define VAX
63 #    ifdef ultrix
64 #       define ULTRIX
65 #    else
66 #       define BSD
67 #    endif
68 #    define mach_type_known
69 # endif
70 # if defined(mips) || defined(__mips)
71 #    define MIPS
72 #    if !defined(LINUX)
73 #      if defined(ultrix) || defined(__ultrix) || defined(__NetBSD__)
74 #        define ULTRIX
75 #      else
76 #        if defined(_SYSTYPE_SVR4) || defined(SYSTYPE_SVR4) \
77             || defined(__SYSTYPE_SVR4__)
78 #          define IRIX5   /* or IRIX 6.X */
79 #        else
80 #          define RISCOS  /* or IRIX 4.X */
81 #        endif
82 #      endif
83 #    endif /* !LINUX */
84 #    define mach_type_known
85 # endif
86 # if defined(sequent) && defined(i386)
87 #    define I386
88 #    define SEQUENT
89 #    define mach_type_known
90 # endif
91 # if defined(sun) && defined(i386)
92 #    define I386
93 #    define SUNOS5
94 #    define mach_type_known
95 # endif
96 # if (defined(__OS2__) || defined(__EMX__)) && defined(__32BIT__)
97 #    define I386
98 #    define OS2
99 #    define mach_type_known
100 # endif
101 # if defined(ibm032)
102 #   define RT
103 #   define mach_type_known
104 # endif
105 # if defined(sun) && (defined(sparc) || defined(__sparc))
106 #   define SPARC
107     /* Test for SunOS 5.x */
108 #     include <errno.h>
109 #     ifdef ECHRNG
110 #       define SUNOS5
111 #     else
112 #       define SUNOS4
113 #     endif
114 #   define mach_type_known
115 # endif
116 # if defined(sparc) && defined(unix) && !defined(sun) && !defined(linux) \
117      && !defined(__OpenBSD__)
118 #   define SPARC
119 #   define DRSNX
120 #   define mach_type_known
121 # endif
122 # if defined(_IBMR2)
123 #   define RS6000
124 #   define mach_type_known
125 # endif
126 # if defined(_M_XENIX) && defined(_M_SYSV) && defined(_M_I386)
127         /* The above test may need refinement   */
128 #   define I386
129 #   if defined(_SCO_ELF)
130 #     define SCO_ELF
131 #   else
132 #     define SCO
133 #   endif
134 #   define mach_type_known
135 # endif
136 # if defined(_AUX_SOURCE)
137 #   define M68K
138 #   define SYSV
139 #   define mach_type_known
140 # endif
141 # if defined(_PA_RISC1_0) || defined(_PA_RISC1_1) || defined(_PA_RISC2_0) \
142      || defined(hppa) || defined(__hppa__)
143 #   define HP_PA
144 #   ifndef LINUX
145 #     define HPUX
146 #   endif
147 #   define mach_type_known
148 # endif
149 # if defined(LINUX) && (defined(i386) || defined(__i386__))
150 #    define I386
151 #    define mach_type_known
152 # endif
153 # if defined(LINUX) && (defined(__ia64__) || defined(__ia64))
154 #    define IA64
155 #    define mach_type_known
156 # endif
157 # if defined(LINUX) && defined(powerpc)
158 #    define POWERPC
159 #    define mach_type_known
160 # endif
161 # if defined(LINUX) && defined(__mc68000__)
162 #    define M68K
163 #    define mach_type_known
164 # endif
165 # if defined(LINUX) && (defined(sparc) || defined(__sparc__))
166 #    define SPARC
167 #    define mach_type_known
168 # endif
169 # if defined(LINUX) && defined(arm)
170 #    define ARM32
171 #    define mach_type_known
172 # endif
173 # if defined(__alpha) || defined(__alpha__)
174 #   define ALPHA
175 #   if !defined(LINUX)
176 #     define OSF1       /* a.k.a Digital Unix */
177 #   endif
178 #   define mach_type_known
179 # endif
180 # if defined(_AMIGA) && !defined(AMIGA)
181 #   define AMIGA
182 # endif
183 # ifdef AMIGA 
184 #   define M68K
185 #   define mach_type_known
186 # endif
187 # if defined(THINK_C) || defined(__MWERKS__) && !defined(__powerc)
188 #   define M68K
189 #   define MACOS
190 #   define mach_type_known
191 # endif
192 # if defined(__MWERKS__) && defined(__powerc)
193 #   define POWERPC
194 #   define MACOS
195 #   define mach_type_known
196 # endif
197 # if defined(macosx)
198 #    define MACOSX
199 #    define POWERPC
200 #    define mach_type_known
201 # endif
202 # if defined(NeXT) && defined(mc68000)
203 #   define M68K
204 #   define NEXT
205 #   define mach_type_known
206 # endif
207 # if defined(NeXT) && defined(i386)
208 #   define I386
209 #   define NEXT
210 #   define mach_type_known
211 # endif
212 # if defined(__OpenBSD__) && defined(i386)
213 #   define I386
214 #   define OPENBSD
215 #   define mach_type_known
216 # endif
217 # if defined(__FreeBSD__) && defined(i386)
218 #   define I386
219 #   define FREEBSD
220 #   define mach_type_known
221 # endif
222 # if defined(__NetBSD__) && defined(i386)
223 #   define I386
224 #   define NETBSD
225 #   define mach_type_known
226 # endif
227 # if defined(bsdi) && defined(i386)
228 #    define I386
229 #    define BSDI
230 #    define mach_type_known
231 # endif
232 # if !defined(mach_type_known) && defined(__386BSD__)
233 #   define I386
234 #   define THREE86BSD
235 #   define mach_type_known
236 # endif
237 # if defined(_CX_UX) && defined(_M88K)
238 #   define M88K
239 #   define CX_UX
240 #   define mach_type_known
241 # endif
242 # if defined(DGUX)
243 #   define M88K
244     /* DGUX defined */
245 #   define mach_type_known
246 # endif
247 # if (defined(_MSDOS) || defined(_MSC_VER)) && (_M_IX86 >= 300) \
248      || defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__)
249 #   define I386
250 #   define MSWIN32      /* or Win32s */
251 #   define mach_type_known
252 # endif
253 # if defined(__DJGPP__)
254 #   define I386
255 #   ifndef DJGPP
256 #     define DJGPP  /* MSDOS running the DJGPP port of GCC */
257 #   endif
258 #   define mach_type_known
259 # endif
260 # if defined(__CYGWIN32__) || defined(__CYGWIN__)
261 #   define I386
262 #   define CYGWIN32
263 #   define mach_type_known
264 # endif
265 # if defined(__MINGW32__)
266 #   define I386
267 #   define MSWIN32
268 #   define mach_type_known
269 # endif
270 # if defined(__BORLANDC__)
271 #   define I386
272 #   define MSWIN32
273 #   define mach_type_known
274 # endif
275 # if defined(_UTS) && !defined(mach_type_known)
276 #   define S370
277 #   define UTS4
278 #   define mach_type_known
279 # endif
280 # if defined(__pj__)
281 #   define PJ
282 #   define mach_type_known
283 # endif
284 /* Ivan Demakov */
285 # if defined(__WATCOMC__) && defined(__386__)
286 #   define I386
287 #   if !defined(OS2) && !defined(MSWIN32) && !defined(DOS4GW)
288 #     if defined(__OS2__)
289 #       define OS2
290 #     else
291 #       if defined(__WINDOWS_386__) || defined(__NT__)
292 #         define MSWIN32
293 #       else
294 #         define DOS4GW
295 #       endif
296 #     endif
297 #   endif
298 #   define mach_type_known
299 # endif
300
301 /* Feel free to add more clauses here */
302
303 /* Or manually define the machine type here.  A machine type is         */
304 /* characterized by the architecture.  Some                             */
305 /* machine types are further subdivided by OS.                          */
306 /* the macros ULTRIX, RISCOS, and BSD to distinguish.                   */
307 /* Note that SGI IRIX is treated identically to RISCOS.                 */
308 /* SYSV on an M68K actually means A/UX.                                 */
309 /* The distinction in these cases is usually the stack starting address */
310 # ifndef mach_type_known
311         --> unknown machine type
312 # endif
313                     /* Mapping is: M68K       ==> Motorola 680X0        */
314                     /*             (SUNOS4,HP,NEXT, and SYSV (A/UX),    */
315                     /*             MACOS and AMIGA variants)            */
316                     /*             I386       ==> Intel 386             */
317                     /*              (SEQUENT, OS2, SCO, LINUX, NETBSD,  */
318                     /*               FREEBSD, THREE86BSD, MSWIN32,      */
319                     /*               BSDI,SUNOS5, NEXT, other variants) */
320                     /*             NS32K      ==> Encore Multimax       */
321                     /*             MIPS       ==> R2000 or R3000        */
322                     /*                  (RISCOS, ULTRIX variants)       */
323                     /*             VAX        ==> DEC VAX               */
324                     /*                  (BSD, ULTRIX variants)          */
325                     /*             RS6000     ==> IBM RS/6000 AIX3.X    */
326                     /*             RT         ==> IBM PC/RT             */
327                     /*             HP_PA      ==> HP9000/700 & /800     */
328                     /*                            HP/UX                 */
329                     /*             SPARC      ==> SPARC under SunOS     */
330                     /*                  (SUNOS4, SUNOS5,                */
331                     /*                   DRSNX variants)                */
332                     /*             ALPHA      ==> DEC Alpha             */
333                     /*                  (OSF1 and LINUX variants)       */
334                     /*             M88K       ==> Motorola 88XX0        */
335                     /*                  (CX_UX and DGUX)                */
336                     /*             S370       ==> 370-like machine      */
337                     /*                  running Amdahl UTS4             */
338                     /*             ARM32      ==> Intel StrongARM       */
339                     /*             IA64       ==> Intel IA64            */
340                     /*                            (e.g. Itanium)        */
341
342
343 /*
344  * For each architecture and OS, the following need to be defined:
345  *
346  * CPP_WORD_SZ is a simple integer constant representing the word size.
347  * in bits.  We assume byte addressibility, where a byte has 8 bits.
348  * We also assume CPP_WORD_SZ is either 32 or 64.
349  * (We care about the length of pointers, not hardware
350  * bus widths.  Thus a 64 bit processor with a C compiler that uses
351  * 32 bit pointers should use CPP_WORD_SZ of 32, not 64. Default is 32.)
352  *
353  * MACH_TYPE is a string representation of the machine type.
354  * OS_TYPE is analogous for the OS.
355  *
356  * ALIGNMENT is the largest N, such that
357  * all pointer are guaranteed to be aligned on N byte boundaries.
358  * defining it to be 1 will always work, but perform poorly.
359  *
360  * DATASTART is the beginning of the data segment.
361  * On UNIX systems, the collector will scan the area between DATASTART
362  * and DATAEND for root pointers.
363  *
364  * DATAEND, if not &end.
365  *
366  * ALIGN_DOUBLE of GC_malloc should return blocks aligned to twice
367  * the pointer size.
368  *
369  * STACKBOTTOM is the cool end of the stack, which is usually the
370  * highest address in the stack.
371  * Under PCR or OS/2, we have other ways of finding thread stacks.
372  * For each machine, the following should:
373  * 1) define STACK_GROWS_UP if the stack grows toward higher addresses, and
374  * 2) define exactly one of
375  *      STACKBOTTOM (should be defined to be an expression)
376  *      HEURISTIC1
377  *      HEURISTIC2
378  * If either of the last two macros are defined, then STACKBOTTOM is computed
379  * during collector startup using one of the following two heuristics:
380  * HEURISTIC1:  Take an address inside GC_init's frame, and round it up to
381  *              the next multiple of STACK_GRAN.
382  * HEURISTIC2:  Take an address inside GC_init's frame, increment it repeatedly
383  *              in small steps (decrement if STACK_GROWS_UP), and read the value
384  *              at each location.  Remember the value when the first
385  *              Segmentation violation or Bus error is signalled.  Round that
386  *              to the nearest plausible page boundary, and use that instead
387  *              of STACKBOTTOM.
388  *
389  * If no expression for STACKBOTTOM can be found, and neither of the above
390  * heuristics are usable, the collector can still be used with all of the above
391  * undefined, provided one of the following is done:
392  * 1) GC_mark_roots can be changed to somehow mark from the correct stack(s)
393  *    without reference to STACKBOTTOM.  This is appropriate for use in
394  *    conjunction with thread packages, since there will be multiple stacks.
395  *    (Allocating thread stacks in the heap, and treating them as ordinary
396  *    heap data objects is also possible as a last resort.  However, this is
397  *    likely to introduce significant amounts of excess storage retention
398  *    unless the dead parts of the thread stacks are periodically cleared.)
399  * 2) Client code may set GC_stackbottom before calling any GC_ routines.
400  *    If the author of the client code controls the main program, this is
401  *    easily accomplished by introducing a new main program, setting
402  *    GC_stackbottom to the address of a local variable, and then calling
403  *    the original main program.  The new main program would read something
404  *    like:
405  *
406  *              # include "gc_private.h"
407  *
408  *              main(argc, argv, envp)
409  *              int argc;
410  *              char **argv, **envp;
411  *              {
412  *                  int dummy;
413  *
414  *                  GC_stackbottom = (ptr_t)(&dummy);
415  *                  return(real_main(argc, argv, envp));
416  *              }
417  *
418  *
419  * Each architecture may also define the style of virtual dirty bit
420  * implementation to be used:
421  *   MPROTECT_VDB: Write protect the heap and catch faults.
422  *   PROC_VDB: Use the SVR4 /proc primitives to read dirty bits.
423  *
424  * An architecture may define DYNAMIC_LOADING if dynamic_load.c
425  * defined GC_register_dynamic_libraries() for the architecture.
426  *
427  * An architecture may define PREFETCH(x) to preload the cache with *x.
428  * This defaults to a no-op.
429  *
430  * PREFETCH_FOR_WRITE(x) is used if *x is about to be written.
431  *
432  * An architecture may also define CLEAR_DOUBLE(x) to be a fast way to
433  * clear the two words at GC_malloc-aligned address x.  By default,
434  * word stores of 0 are used instead.
435  */
436
437
438 # define STACK_GRAN 0x1000000
439 # ifdef M68K
440 #   define MACH_TYPE "M68K"
441 #   define ALIGNMENT 2
442 #   ifdef OPENBSD
443 #       define OS_TYPE "OPENBSD"
444 #       define HEURISTIC2
445         extern char etext;
446 #       define DATASTART ((ptr_t)(&etext))
447 #   endif
448 #   ifdef NETBSD
449 #       define OS_TYPE "NETBSD"
450 #       define HEURISTIC2
451         extern char etext;
452 #       define DATASTART ((ptr_t)(&etext))
453 #   endif
454 #   ifdef LINUX
455 #       define OS_TYPE "LINUX"
456 #       define STACKBOTTOM ((ptr_t)0xf0000000)
457 #       define MPROTECT_VDB
458 #       ifdef __ELF__
459 #            define DYNAMIC_LOADING
460              extern char **__environ;
461 #            define DATASTART ((ptr_t)(&__environ))
462                              /* hideous kludge: __environ is the first */
463                              /* word in crt0.o, and delimits the start */
464                              /* of the data segment, no matter which   */
465                              /* ld options were passed through.        */
466                              /* We could use _etext instead, but that  */
467                              /* would include .rodata, which may       */
468                              /* contain large read-only data tables    */
469                              /* that we'd rather not scan.             */
470              extern int _end;
471 #            define DATAEND (&_end)
472 #       else
473              extern int etext;
474 #            define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
475 #       endif
476 #   endif
477 #   ifdef SUNOS4
478 #       define OS_TYPE "SUNOS4"
479         extern char etext;
480 #       define DATASTART ((ptr_t)((((word) (&etext)) + 0x1ffff) & ~0x1ffff))
481 #       define HEURISTIC1       /* differs      */
482 #       define DYNAMIC_LOADING
483 #   endif
484 #   ifdef HP
485 #       define OS_TYPE "HP"
486         extern char etext;
487 #       define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
488 #       define STACKBOTTOM ((ptr_t) 0xffeffffc)
489                               /* empirically determined.  seems to work. */
490 #       include <unistd.h>
491 #       define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
492 #   endif
493 #   ifdef SYSV
494 #       define OS_TYPE "SYSV"
495         extern etext;
496 #       define DATASTART ((ptr_t)((((word) (&etext)) + 0x3fffff) \
497                                    & ~0x3fffff) \
498                                   +((word)&etext & 0x1fff))
499         /* This only works for shared-text binaries with magic number 0413.
500            The other sorts of SysV binaries put the data at the end of the text,
501            in which case the default of &etext would work.  Unfortunately,
502            handling both would require having the magic-number available.
503                                 -- Parag
504            */
505 #       define STACKBOTTOM ((ptr_t)0xFFFFFFFE)
506                         /* The stack starts at the top of memory, but   */
507                         /* 0x0 cannot be used as setjump_test complains */
508                         /* that the stack direction is incorrect.  Two  */
509                         /* bytes down from 0x0 should be safe enough.   */
510                         /*              --Parag                         */
511 #       include <sys/mmu.h>
512 #       define GETPAGESIZE() PAGESIZE   /* Is this still right? */
513 #   endif
514 #   ifdef AMIGA
515 #       define OS_TYPE "AMIGA"
516                 /* STACKBOTTOM and DATASTART handled specially  */
517                 /* in os_dep.c                                  */
518 #       define DATAEND  /* not needed */
519 #       define GETPAGESIZE() 4096
520 #   endif
521 #   ifdef MACOS
522 #     ifndef __LOWMEM__
523 #     include <LowMem.h>
524 #     endif
525 #     define OS_TYPE "MACOS"
526                         /* see os_dep.c for details of global data segments. */
527 #     define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
528 #     define DATAEND    /* not needed */
529 #     define GETPAGESIZE() 4096
530 #   endif
531 #   ifdef NEXT
532 #       define OS_TYPE "NEXT"
533 #       define DATASTART ((ptr_t) get_etext())
534 #       define STACKBOTTOM ((ptr_t) 0x4000000)
535 #       define DATAEND  /* not needed */
536 #   endif
537 # endif
538
539 # ifdef POWERPC
540 #   define MACH_TYPE "POWERPC"
541 #   ifdef MACOS
542 #     define ALIGNMENT 2  /* Still necessary?  Could it be 4?   */
543 #     ifndef __LOWMEM__
544 #     include <LowMem.h>
545 #     endif
546 #     define OS_TYPE "MACOS"
547                         /* see os_dep.c for details of global data segments. */
548 #     define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
549 #     define DATAEND  /* not needed */
550 #   endif
551 #   ifdef LINUX
552 #     define ALIGNMENT 4        /* Guess.  Can someone verify?  */
553                                 /* This was 2, but that didn't sound right. */
554 #     define OS_TYPE "LINUX"
555 #     define HEURISTIC1
556 #     undef STACK_GRAN
557 #     define STACK_GRAN 0x10000000
558         /* Stack usually starts at 0x80000000 */
559 #     define LINUX_DATA_START
560       extern int _end;
561 #     define DATAEND (&_end)
562 #   endif
563 #   ifdef MACOSX
564 #     define ALIGNMENT 4
565 #     define OS_TYPE "MACOSX"
566 #     define DATASTART ((ptr_t) get_etext())
567 #     define STACKBOTTOM ((ptr_t) 0xc0000000)
568 #     define DATAEND    /* not needed */
569 #   endif
570 # endif
571
572 # ifdef VAX
573 #   define MACH_TYPE "VAX"
574 #   define ALIGNMENT 4  /* Pointers are longword aligned by 4.2 C compiler */
575     extern char etext;
576 #   define DATASTART ((ptr_t)(&etext))
577 #   ifdef BSD
578 #       define OS_TYPE "BSD"
579 #       define HEURISTIC1
580                         /* HEURISTIC2 may be OK, but it's hard to test. */
581 #   endif
582 #   ifdef ULTRIX
583 #       define OS_TYPE "ULTRIX"
584 #       define STACKBOTTOM ((ptr_t) 0x7fffc800)
585 #   endif
586 # endif
587
588 # ifdef RT
589 #   define MACH_TYPE "RT"
590 #   define ALIGNMENT 4
591 #   define DATASTART ((ptr_t) 0x10000000)
592 #   define STACKBOTTOM ((ptr_t) 0x1fffd800)
593 # endif
594
595 # ifdef SPARC
596 #   define MACH_TYPE "SPARC"
597 #   define ALIGNMENT 4  /* Required by hardware */
598 #   define ALIGN_DOUBLE
599     extern int etext;
600 #   ifdef SUNOS5
601 #       define OS_TYPE "SUNOS5"
602         extern int _etext;
603         extern int _end;
604         extern char * GC_SysVGetDataStart();
605 #       define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
606 #       define DATAEND (&_end)
607 #       ifndef USE_MMAP
608 #           define USE_MMAP
609 #       endif
610 #       ifdef USE_MMAP
611 #         define HEAP_START (ptr_t)0x40000000
612 #       else
613 #         define HEAP_START DATAEND
614 #       endif
615 #       define PROC_VDB
616 /*      HEURISTIC1 reportedly no longer works under 2.7.  Thus we       */
617 /*      switched to HEURISTIC2, eventhough it creates some debugging    */
618 /*      issues.                                                         */
619 #       define HEURISTIC2
620 #       include <unistd.h>
621 #       define GETPAGESIZE()  sysconf(_SC_PAGESIZE)
622                 /* getpagesize() appeared to be missing from at least one */
623                 /* Solaris 5.4 installation.  Weird.                      */
624 #       define DYNAMIC_LOADING
625 #   endif
626 #   ifdef SUNOS4
627 #       define OS_TYPE "SUNOS4"
628         /* [If you have a weak stomach, don't read this.]               */
629         /* We would like to use:                                        */
630 /* #       define DATASTART ((ptr_t)((((word) (&etext)) + 0x1fff) & ~0x1fff)) */
631         /* This fails occasionally, due to an ancient, but very         */
632         /* persistent ld bug.  &etext is set 32 bytes too high.         */
633         /* We instead read the text segment size from the a.out         */
634         /* header, which happens to be mapped into our address space    */
635         /* at the start of the text segment.  The detective work here   */
636         /* was done by Robert Ehrlich, Manuel Serrano, and Bernard      */
637         /* Serpette of INRIA.                                           */
638         /* This assumes ZMAGIC, i.e. demand-loadable executables.       */
639 #       define TEXTSTART 0x2000
640 #       define DATASTART ((ptr_t)(*(int *)(TEXTSTART+0x4)+TEXTSTART))
641 #       define MPROTECT_VDB
642 #       define HEURISTIC1
643 #       define DYNAMIC_LOADING
644 #   endif
645 #   ifdef DRSNX
646 #       define CPP_WORDSZ 32
647 #       define OS_TYPE "DRSNX"
648         extern char * GC_SysVGetDataStart();
649         extern int etext;
650 #       define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &etext)
651 #       define MPROTECT_VDB
652 #       define STACKBOTTOM ((ptr_t) 0xdfff0000)
653 #       define DYNAMIC_LOADING
654 #   endif
655 #   ifdef LINUX
656 #     define OS_TYPE "LINUX"
657 #     ifdef __ELF__
658 #       define LINUX_DATA_START
659 #       define DYNAMIC_LOADING
660 #     else
661           Linux Sparc non elf ?
662 #     endif
663       extern int _end;
664 #     define DATAEND (&_end)
665 #     define SVR4
666 #     define STACKBOTTOM ((ptr_t) 0xf0000000)
667 #   endif
668 #   ifdef OPENBSD
669 #     define OS_TYPE "OPENBSD"
670 #     define STACKBOTTOM ((ptr_t) 0xf8000000)
671 #     define DATASTART ((ptr_t)(&etext))
672 #   endif
673 # endif
674
675 # ifdef I386
676 #   define MACH_TYPE "I386"
677 #   define ALIGNMENT 4  /* Appears to hold for all "32 bit" compilers   */
678                         /* except Borland.  The -a4 option fixes        */
679                         /* Borland.                                     */
680                         /* Ivan Demakov: For Watcom the option is -zp4. */
681 #   ifndef SMALL_CONFIG
682 #     define ALIGN_DOUBLE /* Not strictly necessary, but may give speed   */
683                           /* improvement on Pentiums.                     */
684 #   endif
685 #   ifdef SEQUENT
686 #       define OS_TYPE "SEQUENT"
687         extern int etext;
688 #       define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
689 #       define STACKBOTTOM ((ptr_t) 0x3ffff000) 
690 #   endif
691 #   ifdef SUNOS5
692 #       define OS_TYPE "SUNOS5"
693         extern int etext, _start;
694         extern char * GC_SysVGetDataStart();
695 #       define DATASTART GC_SysVGetDataStart(0x1000, &etext)
696 #       define STACKBOTTOM ((ptr_t)(&_start))
697 /** At least in Solaris 2.5, PROC_VDB gives wrong values for dirty bits. */
698 /*#     define PROC_VDB*/
699 #       define DYNAMIC_LOADING
700 #       ifndef USE_MMAP
701 #           define USE_MMAP
702 #       endif
703 #       ifdef USE_MMAP
704 #         define HEAP_START (ptr_t)0x40000000
705 #       else
706 #         define HEAP_START DATAEND
707 #       endif
708 #   endif
709 #   ifdef SCO
710 #       define OS_TYPE "SCO"
711         extern int etext;
712 #       define DATASTART ((ptr_t)((((word) (&etext)) + 0x3fffff) \
713                                   & ~0x3fffff) \
714                                  +((word)&etext & 0xfff))
715 #       define STACKBOTTOM ((ptr_t) 0x7ffffffc)
716 #   endif
717 #   ifdef SCO_ELF
718 #       define OS_TYPE "SCO_ELF"
719         extern int etext;
720 #       define DATASTART ((ptr_t)(&etext))
721 #       define STACKBOTTOM ((ptr_t) 0x08048000)
722 #       define DYNAMIC_LOADING
723 #       define ELF_CLASS ELFCLASS32
724 #   endif
725 #   ifdef LINUX
726 #       define OS_TYPE "LINUX"
727 #       define LINUX_STACKBOTTOM
728 #       if 0
729 #         define HEURISTIC1
730 #         undef STACK_GRAN
731 #         define STACK_GRAN 0x10000000
732           /* STACKBOTTOM is usually 0xc0000000, but this changes with   */
733           /* different kernel configurations.  In particular, systems   */
734           /* with 2GB physical memory will usually move the user        */
735           /* address space limit, and hence initial SP to 0x80000000.   */
736 #       endif
737 #       if !defined(LINUX_THREADS) || !defined(REDIRECT_MALLOC)
738 #           define MPROTECT_VDB
739 #       else
740             /* We seem to get random errors in incremental mode,        */
741             /* possibly because Linux threads is itself a malloc client */
742             /* and can't deal with the signals.                         */
743 #       endif
744 #       ifdef __ELF__
745 #            define DYNAMIC_LOADING
746 #            ifdef UNDEFINED    /* includes ro data */
747                extern int _etext;
748 #              define DATASTART ((ptr_t)((((word) (&_etext)) + 0xfff) & ~0xfff))
749 #            endif
750 #            include <features.h>
751 #            if defined(__GLIBC__) && __GLIBC__ >= 2
752 #                define LINUX_DATA_START
753 #            else
754                  extern char **__environ;
755 #                define DATASTART ((ptr_t)(&__environ))
756                               /* hideous kludge: __environ is the first */
757                               /* word in crt0.o, and delimits the start */
758                               /* of the data segment, no matter which   */
759                               /* ld options were passed through.        */
760                               /* We could use _etext instead, but that  */
761                               /* would include .rodata, which may       */
762                               /* contain large read-only data tables    */
763                               /* that we'd rather not scan.             */
764 #            endif
765              extern int _end;
766 #            define DATAEND (&_end)
767 #       else
768              extern int etext;
769 #            define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
770 #       endif
771 #       ifdef USE_I686_PREFETCH
772 #         define PREFETCH(x) \
773             __asm__ __volatile__ ("     prefetchnta     %0": : "m"(*(char *)(x)))
774             /* Empirically prefetcht0 is much more effective at reducing        */
775             /* cache miss stalls for the targetted load instructions.  But it   */
776             /* seems to interfere enough with other cache traffic that the net  */
777             /* result is worse than prefetchnta.                                */
778 #         if 0 
779             /* Using prefetches for write seems to have a slight negative       */
780             /* impact on performance, at least for a PIII/500.                  */
781 #           define PREFETCH_FOR_WRITE(x) \
782               __asm__ __volatile__ ("   prefetcht0      %0": : "m"(*(char *)(x)))
783 #         endif
784 #       endif
785 #       ifdef USE_3DNOW_PREFETCH
786 #         define PREFETCH(x) \
787             __asm__ __volatile__ ("     prefetch        %0": : "m"(*(char *)(x)))
788 #         define PREFETCH_FOR_WRITE(x) 
789             __asm__ __volatile__ ("     prefetchw       %0": : "m"(*(char *)(x)))
790 #       endif
791 #   endif
792 #   ifdef CYGWIN32
793 #       define OS_TYPE "CYGWIN32"
794           extern int _data_start__;
795           extern int _data_end__;
796           extern int _bss_start__;
797           extern int _bss_end__;
798         /* For binutils 2.9.1, we have                  */
799         /*      DATASTART   = _data_start__             */
800         /*      DATAEND     = _bss_end__                */
801         /* whereas for some earlier versions it was     */
802         /*      DATASTART   = _bss_start__              */
803         /*      DATAEND     = _data_end__               */
804         /* To get it right for both, we take the        */
805         /* minumum/maximum of the two.                  */
806 #       define MAX(x,y) ((x) > (y) ? (x) : (y))
807 #       define MIN(x,y) ((x) < (y) ? (x) : (y))
808 #       define DATASTART ((ptr_t) MIN(&_data_start__, &_bss_start__))
809 #       define DATAEND   ((ptr_t) MAX(&_data_end__, &_bss_end__))
810 #       undef STACK_GRAN
811 #       define STACK_GRAN 0x10000
812 #       define HEURISTIC1
813 #   endif
814 #   ifdef OS2
815 #       define OS_TYPE "OS2"
816                 /* STACKBOTTOM and DATASTART are handled specially in   */
817                 /* os_dep.c. OS2 actually has the right                 */
818                 /* system call!                                         */
819 #       define DATAEND  /* not needed */
820 #   endif
821 #   ifdef MSWIN32
822 #       define OS_TYPE "MSWIN32"
823                 /* STACKBOTTOM and DATASTART are handled specially in   */
824                 /* os_dep.c.                                            */
825 #       ifndef __WATCOMC__
826 #         define MPROTECT_VDB
827 #       endif
828 #       define DATAEND  /* not needed */
829 #   endif
830 #   ifdef DJGPP
831 #       define OS_TYPE "DJGPP"
832 #       include "stubinfo.h"
833         extern int etext;
834         extern int _stklen;
835         extern int __djgpp_stack_limit;
836 #       define DATASTART ((ptr_t)((((word) (&etext)) + 0x1ff) & ~0x1ff))
837 /* #       define STACKBOTTOM ((ptr_t)((word) _stubinfo + _stubinfo->size \
838                                                      + _stklen)) */
839 #       define STACKBOTTOM ((ptr_t)((word) __djgpp_stack_limit + _stklen))
840                 /* This may not be right.  */
841 #   endif
842 #   ifdef OPENBSD
843 #       define OS_TYPE "OPENBSD"
844 #   endif
845 #   ifdef FREEBSD
846 #       define OS_TYPE "FREEBSD"
847 #       define MPROTECT_VDB
848 #   endif
849 #   ifdef NETBSD
850 #       define OS_TYPE "NETBSD"
851 #   endif
852 #   ifdef THREE86BSD
853 #       define OS_TYPE "THREE86BSD"
854 #   endif
855 #   ifdef BSDI
856 #       define OS_TYPE "BSDI"
857 #   endif
858 #   if defined(OPENBSD) || defined(FREEBSD) || defined(NETBSD) \
859         || defined(THREE86BSD) || defined(BSDI)
860 #       define HEURISTIC2
861         extern char etext;
862 #       define DATASTART ((ptr_t)(&etext))
863 #   endif
864 #   ifdef NEXT
865 #       define OS_TYPE "NEXT"
866 #       define DATASTART ((ptr_t) get_etext())
867 #       define STACKBOTTOM ((ptr_t)0xc0000000)
868 #       define DATAEND  /* not needed */
869 #   endif
870 #   ifdef DOS4GW
871 #     define OS_TYPE "DOS4GW"
872       extern long __nullarea;
873       extern char _end;
874       extern char *_STACKTOP;
875       /* Depending on calling conventions Watcom C either precedes
876          or does not precedes with undescore names of C-variables.
877          Make sure startup code variables always have the same names.  */
878       #pragma aux __nullarea "*";
879       #pragma aux _end "*";
880 #     define STACKBOTTOM ((ptr_t) _STACKTOP)
881                          /* confused? me too. */
882 #     define DATASTART ((ptr_t) &__nullarea)
883 #     define DATAEND ((ptr_t) &_end)
884 #   endif
885 # endif
886
887 # ifdef NS32K
888 #   define MACH_TYPE "NS32K"
889 #   define ALIGNMENT 4
890     extern char **environ;
891 #   define DATASTART ((ptr_t)(&environ))
892                               /* hideous kludge: environ is the first   */
893                               /* word in crt0.o, and delimits the start */
894                               /* of the data segment, no matter which   */
895                               /* ld options were passed through.        */
896 #   define STACKBOTTOM ((ptr_t) 0xfffff000) /* for Encore */
897 # endif
898
899 # ifdef MIPS
900 #   define MACH_TYPE "MIPS"
901 /* #   define STACKBOTTOM ((ptr_t)0x7fff8000)  sometimes also works.  */
902 #   ifdef LINUX
903       /* This was developed for a linuxce style platform.  Probably     */
904       /* needs to be tweaked for workstation class machines.            */
905 #     define OS_TYPE "LINUX"
906       extern int __data_start;
907 #     define DATASTART ((ptr_t)(&__data_start))
908 #     define ALIGNMENT 4
909 #     define USE_GENERIC_PUSH_REGS 1
910 #     define STACKBOTTOM 0x80000000
911         /* In many cases, this should probably use LINUX_STACKBOTTOM    */
912         /* instead. But some kernel versions seem to give the wrong     */
913         /* value from /proc.                                            */
914 #   endif /* Linux */
915 #   ifdef ULTRIX
916 #       define HEURISTIC2
917 #       define DATASTART (ptr_t)0x10000000
918                               /* Could probably be slightly higher since */
919                               /* startup code allocates lots of stuff.   */
920 #       define OS_TYPE "ULTRIX"
921 #       define ALIGNMENT 4
922 #   endif
923 #   ifdef RISCOS
924 #       define HEURISTIC2
925 #       define DATASTART (ptr_t)0x10000000
926 #       define OS_TYPE "RISCOS"
927 #       define ALIGNMENT 4  /* Required by hardware */
928 #   endif
929 #   ifdef IRIX5
930 #       define HEURISTIC2
931         extern int _fdata;
932 #       define DATASTART ((ptr_t)(&_fdata))
933 #       ifdef USE_MMAP
934 #         define HEAP_START (ptr_t)0x30000000
935 #       else
936 #         define HEAP_START DATASTART
937 #       endif
938                               /* Lowest plausible heap address.         */
939                               /* In the MMAP case, we map there.        */
940                               /* In either case it is used to identify  */
941                               /* heap sections so they're not           */
942                               /* considered as roots.                   */
943 #       define OS_TYPE "IRIX5"
944 #       define MPROTECT_VDB
945 #       ifdef _MIPS_SZPTR
946 #         define CPP_WORDSZ _MIPS_SZPTR
947 #         define ALIGNMENT (_MIPS_SZPTR/8)
948 #         if CPP_WORDSZ != 64
949 #           define ALIGN_DOUBLE
950 #         endif
951 #       else
952 #         define ALIGNMENT 4
953 #         define ALIGN_DOUBLE
954 #       endif
955 #       define DYNAMIC_LOADING
956 #   endif
957 # endif
958
959 # ifdef RS6000
960 #   define MACH_TYPE "RS6000"
961 #   define ALIGNMENT 4
962 #   define DATASTART ((ptr_t)0x20000000)
963     extern int errno;
964 #   define STACKBOTTOM ((ptr_t)((ulong)&errno))
965 #   define DYNAMIC_LOADING
966         /* For really old versions of AIX, this may have to be removed. */
967 # endif
968
969 # ifdef HP_PA
970     /* OS is assumed to be HP/UX        */
971 #   define MACH_TYPE "HP_PA"
972 #   define OS_TYPE "HPUX"
973 #   ifdef __LP64__
974 #     define CPP_WORDSZ 64
975 #     define ALIGNMENT 8
976 #   else
977 #     define CPP_WORDSZ 32
978 #     define ALIGNMENT 4
979 #     define ALIGN_DOUBLE
980 #   endif
981     extern int __data_start;
982 #   define DATASTART ((ptr_t)(&__data_start))
983 #   if 0
984         /* The following appears to work for 7xx systems running HP/UX  */
985         /* 9.xx Furthermore, it might result in much faster             */
986         /* collections than HEURISTIC2, which may involve scanning      */
987         /* segments that directly precede the stack.  It is not the     */
988         /* default, since it may not work on older machine/OS           */
989         /* combinations. (Thanks to Raymond X.T. Nijssen for uncovering */
990         /* this.)                                                       */
991 #       define STACKBOTTOM ((ptr_t) 0x7b033000)  /* from /etc/conf/h/param.h */
992 #   else
993 #       define HEURISTIC2
994 #   endif
995 #   define STACK_GROWS_UP
996 #   define DYNAMIC_LOADING
997 #   ifndef HPUX_THREADS
998 #     define MPROTECT_VDB
999 #   endif
1000 #   include <unistd.h>
1001 #   define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
1002 # endif
1003
1004 # ifdef ALPHA
1005 #   define MACH_TYPE "ALPHA"
1006 #   define ALIGNMENT 8
1007 #   define USE_GENERIC_PUSH_REGS
1008         /* Gcc and probably the DEC/Compaq compiler spill pointers to preserved */
1009         /* fp registers in some cases when the target is a 21264.  The assembly */
1010         /* code doesn't handle that yet, and version dependencies make that a   */
1011         /* bit tricky.  Do the easy thing for now.                              */
1012 #   ifdef OSF1
1013 #       define OS_TYPE "OSF1"
1014 #       define DATASTART ((ptr_t) 0x140000000)
1015         extern _end;
1016 #       define DATAEND ((ptr_t) &_end)
1017 #       define HEURISTIC2
1018         /* Normally HEURISTIC2 is too conervative, since                */
1019         /* the text segment immediately follows the stack.              */
1020         /* Hence we give an upper pound.                                */
1021         extern int __start;
1022 #       define HEURISTIC2_LIMIT ((ptr_t)((word)(&__start) & ~(getpagesize()-1)))
1023 #       define CPP_WORDSZ 64
1024 #       define MPROTECT_VDB
1025 #       define DYNAMIC_LOADING
1026 #   endif
1027 #   ifdef LINUX
1028 #       define OS_TYPE "LINUX"
1029 #       define CPP_WORDSZ 64
1030 #       define STACKBOTTOM ((ptr_t) 0x120000000)
1031 #       ifdef __ELF__
1032 #         define LINUX_DATA_START
1033 #         define DYNAMIC_LOADING
1034           /* This doesn't work if the collector is in a dynamic library. */
1035 #       else
1036 #           define DATASTART ((ptr_t) 0x140000000)
1037 #       endif
1038         extern int _end;
1039 #       define DATAEND (&_end)
1040 #       define MPROTECT_VDB
1041                 /* Has only been superficially tested.  May not */
1042                 /* work on all versions.                        */
1043 #   endif
1044 # endif
1045
1046 # ifdef IA64
1047 #   define MACH_TYPE "IA64"
1048 #   define ALIGN_DOUBLE
1049         /* Requires 16 byte alignment for malloc */
1050 #   define ALIGNMENT 8
1051 #   define USE_GENERIC_PUSH_REGS
1052         /* We need to get preserved registers in addition to register windows.  */
1053         /* That's easiest to do with setjmp.                                    */
1054 #   ifdef HPUX
1055         --> needs work
1056 #   endif
1057 #   ifdef LINUX
1058 #       define OS_TYPE "LINUX"
1059 #       define CPP_WORDSZ 64
1060         /* This should really be done through /proc, but that   */
1061         /* requires we run on an IA64 kernel.                   */
1062 #       define STACKBOTTOM ((ptr_t) 0xa000000000000000l)
1063         /* We also need the base address of the register stack  */
1064         /* backing store.  There is probably a better way to    */
1065         /* get that, too ...                                    */
1066 #       define BACKING_STORE_BASE ((ptr_t) 0x9fffffff80000000l)
1067 #       if 1
1068 #           define SEARCH_FOR_DATA_START
1069 #           define DATASTART GC_data_start
1070 #       else
1071             extern int data_start;
1072 #           define DATASTART ((ptr_t)(&data_start))
1073 #       endif
1074 #       define DYNAMIC_LOADING
1075 #       define MPROTECT_VDB
1076                 /* Requires Linux 2.3.47 or later.      */
1077         extern int _end;
1078 #       define DATAEND (&_end)
1079         /* PREFETCH appears to have a large performance impact. */
1080 #       define PREFETCH(x) \
1081           __asm__ ("    lfetch  [%0]": : "r"((void *)(x)))
1082 #       define PREFETCH_FOR_WRITE(x) \
1083           __asm__ ("    lfetch.excl     [%0]": : "r"((void *)(x)))
1084 #       define CLEAR_DOUBLE(x) \
1085           __asm__ ("    stf.spill       [%0]=f0": : "r"((void *)(x)))
1086 #   endif
1087 # endif
1088
1089 # ifdef M88K
1090 #   define MACH_TYPE "M88K"
1091 #   define ALIGNMENT 4
1092 #   define ALIGN_DOUBLE
1093     extern int etext;
1094 #   ifdef CX_UX
1095 #       define OS_TYPE "CX_UX"
1096 #       define DATASTART ((((word)&etext + 0x3fffff) & ~0x3fffff) + 0x10000)
1097 #   endif
1098 #   ifdef  DGUX
1099 #       define OS_TYPE "DGUX"
1100         extern char * GC_SysVGetDataStart();
1101 #       define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &etext)
1102 #   endif
1103 #   define STACKBOTTOM ((char*)0xf0000000) /* determined empirically */
1104 # endif
1105
1106 # ifdef S370
1107 #   define MACH_TYPE "S370"
1108 #   define OS_TYPE "UTS4"
1109 #   define ALIGNMENT 4  /* Required by hardware */
1110     extern int etext;
1111         extern int _etext;
1112         extern int _end;
1113         extern char * GC_SysVGetDataStart();
1114 #       define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
1115 #       define DATAEND (&_end)
1116 #       define HEURISTIC2
1117 # endif
1118
1119 # if defined(PJ)
1120 #   define ALIGNMENT 4
1121     extern int _etext;
1122 #   define DATASTART ((ptr_t)(&_etext))
1123 #   define HEURISTIC1
1124 # endif
1125
1126 # ifdef ARM32
1127 #   define CPP_WORDSZ 32
1128 #   define MACH_TYPE "ARM32"
1129 #   define ALIGNMENT 4
1130 #   ifdef NETBSD
1131 #       define OS_TYPE "NETBSD"
1132 #       define HEURISTIC2
1133         extern char etext;
1134 #       define DATASTART ((ptr_t)(&etext))
1135 #       define USE_GENERIC_PUSH_REGS
1136 #   endif
1137 #   ifdef LINUX
1138 #       define OS_TYPE "LINUX"
1139 #       define HEURISTIC1
1140 #       undef STACK_GRAN
1141 #       define STACK_GRAN 0x10000000
1142 #       define USE_GENERIC_PUSH_REGS
1143 #       ifdef __ELF__
1144 #            define DYNAMIC_LOADING
1145 #            include <features.h>
1146 #            if defined(__GLIBC__) && __GLIBC__ >= 2
1147 #                define LINUX_DATA_START
1148 #            else
1149                  extern char **__environ;
1150 #                define DATASTART ((ptr_t)(&__environ))
1151                               /* hideous kludge: __environ is the first */
1152                               /* word in crt0.o, and delimits the start */
1153                               /* of the data segment, no matter which   */
1154                               /* ld options were passed through.        */
1155                               /* We could use _etext instead, but that  */
1156                               /* would include .rodata, which may       */
1157                               /* contain large read-only data tables    */
1158                               /* that we'd rather not scan.             */
1159 #            endif
1160              extern int _end;
1161 #            define DATAEND (&_end)
1162 #       else
1163              extern int etext;
1164 #            define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
1165 #       endif
1166 #   endif
1167 #endif
1168
1169 #ifdef LINUX_DATA_START
1170     /* Some Linux distributions arrange to define __data_start.  Some   */
1171     /* define data_start as a weak symbol.  The latter is technically   */
1172     /* broken, since the user program may define data_start, in which   */
1173     /* case we lose.  Nonetheless, we try both, prefering __data_start. */
1174     /* We assume gcc.   */
1175 #   pragma weak __data_start
1176     extern int __data_start;
1177 #   pragma weak data_start
1178     extern int data_start;
1179 #   define DATASTART ((ptr_t)(&__data_start != 0? &__data_start : &data_start))
1180 #endif
1181
1182 # ifndef STACK_GROWS_UP
1183 #   define STACK_GROWS_DOWN
1184 # endif
1185
1186 # ifndef CPP_WORDSZ
1187 #   define CPP_WORDSZ 32
1188 # endif
1189
1190 # ifndef OS_TYPE
1191 #   define OS_TYPE ""
1192 # endif
1193
1194 # ifndef DATAEND
1195     extern int end;
1196 #   define DATAEND (&end)
1197 # endif
1198
1199 # if defined(SVR4) && !defined(GETPAGESIZE)
1200 #    include <unistd.h>
1201 #    define GETPAGESIZE()  sysconf(_SC_PAGESIZE)
1202 # endif
1203
1204 # ifndef GETPAGESIZE
1205 #   if defined(SUNOS5) || defined(IRIX5)
1206 #       include <unistd.h>
1207 #   endif
1208 #   define GETPAGESIZE() getpagesize()
1209 # endif
1210
1211 # if defined(SUNOS5) || defined(DRSNX) || defined(UTS4)
1212     /* OS has SVR4 generic features.  Probably others also qualify.     */
1213 #   define SVR4
1214 # endif
1215
1216 # if defined(SUNOS5) || defined(DRSNX)
1217     /* OS has SUNOS5 style semi-undocumented interface to dynamic       */
1218     /* loader.                                                          */
1219 #   define SUNOS5DL
1220     /* OS has SUNOS5 style signal handlers.                             */
1221 #   define SUNOS5SIGS
1222 # endif
1223
1224 # if defined(HPUX)
1225 #   define SUNOS5SIGS
1226 # endif
1227
1228 # if CPP_WORDSZ != 32 && CPP_WORDSZ != 64
1229    -> bad word size
1230 # endif
1231
1232 # ifdef PCR
1233 #   undef DYNAMIC_LOADING
1234 #   undef STACKBOTTOM
1235 #   undef HEURISTIC1
1236 #   undef HEURISTIC2
1237 #   undef PROC_VDB
1238 #   undef MPROTECT_VDB
1239 #   define PCR_VDB
1240 # endif
1241
1242 # ifdef SRC_M3
1243 /* Postponed for now. */
1244 #   undef PROC_VDB
1245 #   undef MPROTECT_VDB
1246 # endif
1247
1248 # ifdef SMALL_CONFIG
1249 /* Presumably not worth the space it takes. */
1250 #   undef PROC_VDB
1251 #   undef MPROTECT_VDB
1252 # endif
1253
1254 # ifdef USE_MUNMAP
1255 #   undef MPROTECT_VDB  /* Can't deal with address space holes. */
1256 # endif
1257
1258 # if !defined(PCR_VDB) && !defined(PROC_VDB) && !defined(MPROTECT_VDB)
1259 #   define DEFAULT_VDB
1260 # endif
1261
1262 # ifndef PREFETCH
1263 #   define PREFETCH(x)
1264 #   define NO_PREFETCH
1265 # endif
1266
1267 # ifndef PREFETCH_FOR_WRITE
1268 #   define PREFETCH_FOR_WRITE(x)
1269 #   define NO_PREFETCH_FOR_WRITE
1270 # endif
1271
1272 # ifndef CACHE_LINE_SIZE
1273 #   define CACHE_LINE_SIZE 32   /* Wild guess   */
1274 # endif
1275
1276 # ifndef CLEAR_DOUBLE
1277 #   define CLEAR_DOUBLE(x) \
1278         ((word*)x)[0] = 0; \
1279         ((word*)x)[1] = 0;
1280 # endif /* CLEAR_DOUBLE */
1281
1282 # if defined(_SOLARIS_PTHREADS) && !defined(SOLARIS_THREADS)
1283 #   define SOLARIS_THREADS
1284 # endif
1285 # if defined(IRIX_THREADS) && !defined(IRIX5)
1286 --> inconsistent configuration
1287 # endif
1288 # if defined(IRIX_JDK_THREADS) && !defined(IRIX5)
1289 --> inconsistent configuration
1290 # endif
1291 # if defined(LINUX_THREADS) && !defined(LINUX)
1292 --> inconsistent configuration
1293 # endif
1294 # if defined(SOLARIS_THREADS) && !defined(SUNOS5)
1295 --> inconsistent configuration
1296 # endif
1297 # if defined(HPUX_THREADS) && !defined(HPUX)
1298 --> inconsistent configuration
1299 # endif
1300 # if defined(PCR) || defined(SRC_M3) || \
1301         defined(SOLARIS_THREADS) || defined(WIN32_THREADS) || \
1302         defined(IRIX_THREADS) || defined(LINUX_THREADS) || \
1303         defined(IRIX_JDK_THREADS) || defined(HPUX_THREADS)
1304 #   define THREADS
1305 # endif
1306
1307 # if defined(HP_PA) || defined(M88K) || defined(POWERPC) \
1308      || (defined(I386) && defined(OS2)) || defined(UTS4) || defined(LINT)
1309         /* Use setjmp based hack to mark from callee-save registers. */
1310 #       define USE_GENERIC_PUSH_REGS
1311 # endif
1312 # if defined(SPARC) && !defined(LINUX)
1313 #   define SAVE_CALL_CHAIN
1314 #   define ASM_CLEAR_CODE       /* Stack clearing is crucial, and we    */
1315                                 /* include assembly code to do it well. */
1316 # endif
1317
1318 # endif /* GCCONFIG_H */