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