📄 gcconfig.h
字号:
# ifdef VAX# define MACH_TYPE "VAX"# define ALIGNMENT 4 /* Pointers are longword aligned by 4.2 C compiler */ extern char etext[];# define DATASTART ((ptr_t)(etext))# ifdef BSD# define OS_TYPE "BSD"# define HEURISTIC1 /* HEURISTIC2 may be OK, but it's hard to test. */# endif# ifdef ULTRIX# define OS_TYPE "ULTRIX"# define STACKBOTTOM ((ptr_t) 0x7fffc800)# endif# endif# ifdef RT# define MACH_TYPE "RT"# define ALIGNMENT 4# define DATASTART ((ptr_t) 0x10000000)# define STACKBOTTOM ((ptr_t) 0x1fffd800)# endif# ifdef SPARC# define MACH_TYPE "SPARC"# if defined(__arch64__) || defined(__sparcv9)# define ALIGNMENT 8# define CPP_WORDSZ 64# define ELF_CLASS ELFCLASS64# else# define ALIGNMENT 4 /* Required by hardware */# define CPP_WORDSZ 32# endif# define ALIGN_DOUBLE# ifdef SUNOS5# define OS_TYPE "SUNOS5" extern int _etext[]; extern int _end[]; extern ptr_t GC_SysVGetDataStart();# define DATASTART GC_SysVGetDataStart(0x10000, _etext)# define DATAEND (_end)# if !defined(USE_MMAP) && defined(REDIRECT_MALLOC)# define USE_MMAP /* Otherwise we now use calloc. Mmap may result in the */ /* heap interleaved with thread stacks, which can result in */ /* excessive blacklisting. Sbrk is unusable since it */ /* doesn't interact correctly with the system malloc. */# endif# ifdef USE_MMAP# define HEAP_START (ptr_t)0x40000000# else# define HEAP_START DATAEND# endif# define PROC_VDB/* HEURISTIC1 reportedly no longer works under 2.7. *//* HEURISTIC2 probably works, but this appears to be preferable. *//* Apparently USRSTACK is defined to be USERLIMIT, but in some *//* installations that's undefined. We work around this with a *//* gross hack: */# include <sys/vmparam.h># ifdef USERLIMIT /* This should work everywhere, but doesn't. */# define STACKBOTTOM USRSTACK# else# define HEURISTIC2# endif# include <unistd.h># define GETPAGESIZE() sysconf(_SC_PAGESIZE) /* getpagesize() appeared to be missing from at least one */ /* Solaris 5.4 installation. Weird. */# define DYNAMIC_LOADING# endif# ifdef SUNOS4# define OS_TYPE "SUNOS4" /* [If you have a weak stomach, don't read this.] */ /* We would like to use: *//* # define DATASTART ((ptr_t)((((word) (etext)) + 0x1fff) & ~0x1fff)) */ /* This fails occasionally, due to an ancient, but very */ /* persistent ld bug. etext is set 32 bytes too high. */ /* We instead read the text segment size from the a.out */ /* header, which happens to be mapped into our address space */ /* at the start of the text segment. The detective work here */ /* was done by Robert Ehrlich, Manuel Serrano, and Bernard */ /* Serpette of INRIA. */ /* This assumes ZMAGIC, i.e. demand-loadable executables. */# define TEXTSTART 0x2000# define DATASTART ((ptr_t)(*(int *)(TEXTSTART+0x4)+TEXTSTART))# define MPROTECT_VDB# define HEURISTIC1# define DYNAMIC_LOADING# endif# ifdef DRSNX# define OS_TYPE "DRSNX" extern ptr_t GC_SysVGetDataStart(); extern int etext[];# define DATASTART GC_SysVGetDataStart(0x10000, etext)# define MPROTECT_VDB# define STACKBOTTOM ((ptr_t) 0xdfff0000)# define DYNAMIC_LOADING# endif# ifdef LINUX# define OS_TYPE "LINUX"# ifdef __ELF__# define DYNAMIC_LOADING# else Linux Sparc/a.out not supported# endif extern int _end[]; extern int _etext[];# define DATAEND (_end)# define SVR4 extern ptr_t GC_SysVGetDataStart();# ifdef __arch64__# define DATASTART GC_SysVGetDataStart(0x100000, _etext)# else# define DATASTART GC_SysVGetDataStart(0x10000, _etext)# endif# define LINUX_STACKBOTTOM# endif# ifdef OPENBSD# define OS_TYPE "OPENBSD"# define STACKBOTTOM ((ptr_t) 0xf8000000) extern int etext[];# define DATASTART ((ptr_t)(etext))# endif# ifdef NETBSD# define OS_TYPE "NETBSD"# define HEURISTIC2# ifdef __ELF__# define DATASTART GC_data_start# define DYNAMIC_LOADING# else extern char etext[];# define DATASTART ((ptr_t)(etext))# endif# endif# endif# ifdef I386# define MACH_TYPE "I386"# if defined(__LP64__) || defined(_WIN64)# define CPP_WORDSZ 64# define ALIGNMENT 8# else# define CPP_WORDSZ 32# define ALIGNMENT 4 /* Appears to hold for all "32 bit" compilers */ /* except Borland. The -a4 option fixes */ /* Borland. */ /* Ivan Demakov: For Watcom the option is -zp4. */# endif# ifndef SMALL_CONFIG# define ALIGN_DOUBLE /* Not strictly necessary, but may give speed */ /* improvement on Pentiums. */# endif# ifdef HAVE_BUILTIN_UNWIND_INIT# define USE_GENERIC_PUSH_REGS# endif# ifdef SEQUENT# define OS_TYPE "SEQUENT" extern int etext[];# define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))# define STACKBOTTOM ((ptr_t) 0x3ffff000) # endif# ifdef BEOS# define OS_TYPE "BEOS"# include <OS.h># define GETPAGESIZE() B_PAGE_SIZE extern int etext[];# define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))# endif# ifdef SUNOS5# define OS_TYPE "SUNOS5" extern int _etext[], _end[]; extern ptr_t GC_SysVGetDataStart();# define DATASTART GC_SysVGetDataStart(0x1000, _etext)# define DATAEND (_end)/* # define STACKBOTTOM ((ptr_t)(_start)) worked through 2.7, *//* but reportedly breaks under 2.8. It appears that the stack *//* base is a property of the executable, so this should not break *//* old executables. *//* HEURISTIC2 probably works, but this appears to be preferable. */# include <sys/vm.h># define STACKBOTTOM USRSTACK/* At least in Solaris 2.5, PROC_VDB gives wrong values for dirty bits. *//* It appears to be fixed in 2.8 and 2.9. */# ifdef SOLARIS25_PROC_VDB_BUG_FIXED# define PROC_VDB# endif# define DYNAMIC_LOADING# if !defined(USE_MMAP) && defined(REDIRECT_MALLOC)# define USE_MMAP /* Otherwise we now use calloc. Mmap may result in the */ /* heap interleaved with thread stacks, which can result in */ /* excessive blacklisting. Sbrk is unusable since it */ /* doesn't interact correctly with the system malloc. */# endif# ifdef USE_MMAP# define HEAP_START (ptr_t)0x40000000# else# define HEAP_START DATAEND# endif# endif# ifdef SCO# define OS_TYPE "SCO" extern int etext[];# define DATASTART ((ptr_t)((((word) (etext)) + 0x3fffff) \ & ~0x3fffff) \ +((word)etext & 0xfff))# define STACKBOTTOM ((ptr_t) 0x7ffffffc)# endif# ifdef SCO_ELF# define OS_TYPE "SCO_ELF" extern int etext[];# define DATASTART ((ptr_t)(etext))# define STACKBOTTOM ((ptr_t) 0x08048000)# define DYNAMIC_LOADING# define ELF_CLASS ELFCLASS32# endif# ifdef DGUX# define OS_TYPE "DGUX" extern int _etext, _end; extern ptr_t GC_SysVGetDataStart();# define DATASTART GC_SysVGetDataStart(0x1000, &_etext)# define DATAEND (&_end)# define STACK_GROWS_DOWN# define HEURISTIC2# include <unistd.h># define GETPAGESIZE() sysconf(_SC_PAGESIZE)# define DYNAMIC_LOADING# ifndef USE_MMAP# define USE_MMAP# endif /* USE_MMAP */# define MAP_FAILED (void *) -1# ifdef USE_MMAP# define HEAP_START (ptr_t)0x40000000# else /* USE_MMAP */# define HEAP_START DATAEND# endif /* USE_MMAP */# endif /* DGUX */# ifdef LINUX# ifndef __GNUC__ /* The Intel compiler doesn't like inline assembly */# define USE_GENERIC_PUSH_REGS# endif# define OS_TYPE "LINUX"# define LINUX_STACKBOTTOM# if 0# define HEURISTIC1# undef STACK_GRAN# define STACK_GRAN 0x10000000 /* STACKBOTTOM is usually 0xc0000000, but this changes with */ /* different kernel configurations. In particular, systems */ /* with 2GB physical memory will usually move the user */ /* address space limit, and hence initial SP to 0x80000000. */# endif# if !defined(GC_LINUX_THREADS) || !defined(REDIRECT_MALLOC)# define MPROTECT_VDB# else /* We seem to get random errors in incremental mode, */ /* possibly because Linux threads is itself a malloc client */ /* and can't deal with the signals. */# endif# define HEAP_START (ptr_t)0x1000 /* This encourages mmap to give us low addresses, */ /* thus allowing the heap to grow to ~3GB */# ifdef __ELF__# define DYNAMIC_LOADING# ifdef UNDEFINED /* includes ro data */ extern int _etext[];# define DATASTART ((ptr_t)((((word) (_etext)) + 0xfff) & ~0xfff))# endif# include <features.h># if defined(__GLIBC__) && __GLIBC__ >= 2# define SEARCH_FOR_DATA_START# else extern char **__environ;# define DATASTART ((ptr_t)(&__environ)) /* hideous kludge: __environ is the first */ /* word in crt0.o, and delimits the start */ /* of the data segment, no matter which */ /* ld options were passed through. */ /* We could use _etext instead, but that */ /* would include .rodata, which may */ /* contain large read-only data tables */ /* that we'd rather not scan. */# endif extern int _end[];# define DATAEND (_end)# else extern int etext[];# define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))# endif# ifdef USE_I686_PREFETCH /* FIXME: Thus should use __builtin_prefetch, but we'll leave that */ /* for the next rtelease. */# define PREFETCH(x) \ __asm__ __volatile__ (" prefetchnta %0": : "m"(*(char *)(x))) /* Empirically prefetcht0 is much more effective at reducing */ /* cache miss stalls for the targetted load instructions. But it */ /* seems to interfere enough with other cache traffic that the net */ /* result is worse than prefetchnta. */# if 0 /* Using prefetches for write seems to have a slight negative */ /* impact on performance, at least for a PIII/500. */# define PREFETCH_FOR_WRITE(x) \ __asm__ __volatile__ (" prefetcht0 %0": : "m"(*(char *)(x)))# endif# endif# ifdef USE_3DNOW_PREFETCH# define PREFETCH(x) \ __asm__ __volatile__ (" prefetch %0": : "m"(*(char *)(x)))# define PREFETCH_FOR_WRITE(x) \ __asm__ __volatile__ (" prefetchw %0": : "m"(*(char *)(x)))# endif# endif# ifdef CYGWIN32# define OS_TYPE "CYGWIN32" extern int _data_start__[]; extern int _data_end__[]; extern int _bss_start__[]; extern int _bss_end__[]; /* For binutils 2.9.1, we have */ /* DATASTART = _data_start__ */ /* DATAEND = _bss_end__ */ /* whereas for some earlier versions it was */ /* DATASTART = _bss_start__ */ /* DATAEND = _data_end__ */ /* To get it right for both, we take the */ /* minumum/maximum of the two. */# ifndef MAX# define MAX(x,y) ((x) > (y) ? (x) : (y))# endif# ifndef MIN# define MIN(x,y) ((x) < (y) ? (x) : (y))# endif# define DATASTART ((ptr_t) MIN(_data_start__, _bss_start__))# define DATAEND ((ptr_t) MAX(_data_end__, _bss_end__))# undef STACK_GRAN# define STACK_GRAN 0x10000# define HEURISTIC1# endif# ifdef OS2# define OS_TYPE "OS2" /* STACKBOTTOM and DATASTART are handled specially in */ /* os_dep.c. OS2 actually has the right */ /* system call! */# define DATAEND /* not needed */# define USE_GENERIC_PUSH_REGS# endif# ifdef MSWIN32# define OS_TYPE "MSWIN32" /* STACKBOTTOM and DATASTART are handled specially in */ /* os_dep.c. */# ifndef __WATCOMC__# define MPROTECT_VDB# endif# define DATAEND /* not needed */# endif# ifdef MSWINCE# define OS_TYPE "MSWINCE"# define DATAEND /* not needed */# endif# ifdef DJGPP# define OS_TYPE "DJGPP"# include "stubinfo.h" extern int etext[]; extern int _stklen; extern int __djgpp_stack_limit;# define DATASTART ((ptr_t)((((word) (etext)) + 0x1ff) & ~0x1ff))/* # define STACKBOTTOM ((ptr_t)((word) _stubinfo + _stubinfo->size \ + _stklen)) */# define STACKBOTTOM ((ptr_t)((word) __djgpp_stack_limit + _stklen)) /* This may not be right. */# endif# ifdef OPENBSD# define OS_TYPE "OPENBSD"# endif# ifdef FREEBSD# define OS_TYPE "FREEBSD"# ifndef GC_FREEBSD_THREADS# define MPROTECT_VDB# endif# define SIG_SUSPEND SIGUSR1# define SIG_THR_RESTART SIGUSR2# define FREEBSD_STACKBOTTOM# ifdef __ELF__# define DYNAMIC_LOADING# endif extern char etext[]; extern char * GC_FreeBSDGetDataStart();# define DATASTART GC_FreeBSDGetDataStart(0x1000, &etext)# endif# ifdef NETBSD# define OS_TYPE "NETBSD"# ifdef __ELF__# define DYNAMIC_LOADING# endif# endif# ifdef THREE86BSD# define OS_TYPE "THREE86BSD"# endif# ifdef BSDI# define OS_TYPE "BSDI"# endif# if defined(OPENBSD) || defined(NETBSD) \ || defined(THREE86BSD) || defined(BSDI)# define HEURISTIC2 extern char etext[];# define DATASTART ((ptr_t)(etext))# endif# ifdef NEXT# define OS_TYPE "NEXT"# define DATASTART ((ptr_t) get_etext())# define STACKBOTTOM ((ptr_t)0xc0000000)# define DATAEND /* not needed */# endif# ifdef DOS4GW
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -