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