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