New test.
[mono.git] / libgc / include / private / gcconfig.h
index 4aeb31d8c1b4ac2ede6161513521f2a418f05608..0069b8ed6119034ea54614e2bb413ca070aa9957 100644 (file)
 #    define FREEBSD
 # endif
 
+/* And one for Darwin: */
+# if defined(macosx) || (defined(__APPLE__) && defined(__MACH__))
+#   define DARWIN
+# endif
+
 /* Determine the machine type: */
 # if defined(__arm__) || defined(__thumb__)
 #    define ARM32
-#    if !defined(LINUX) && !defined(NETBSD)
+#    if !defined(LINUX) && !defined(NETBSD) && !defined(DARWIN)
 #      define NOSYS
 #      define mach_type_known
 #    endif
 #   define MACOS
 #   define mach_type_known
 # endif
-# if defined(macosx) || (defined(__APPLE__) && defined(__MACH__))
-#   define DARWIN
+# ifdef DARWIN
 #   if defined(__ppc__)  || defined(__ppc64__)
 #    define POWERPC
 #    define mach_type_known
 #   elif defined(__i386__)
 #    define I386
-     --> Not really supported, but at least we recognize it.
+#    define mach_type_known
+#    define DARWIN_DONT_PARSE_STACK
+#    define OS_TYPE "DARWIN"
+#    define DYNAMIC_LOADING
+     /* XXX: see get_end(3), get_etext() and get_end() should not be used.
+        These aren't used when dyld support is enabled (it is by default) */
+#    define DATASTART ((ptr_t) get_etext())
+#    define DATAEND    ((ptr_t) get_end())
+#    define STACKBOTTOM ((ptr_t) 0xc0000000)
+#    define USE_MMAP
+#    define USE_MMAP_ANON
+#    define USE_ASM_PUSH_REGS
+     /* This is potentially buggy. It needs more testing. See the comments in
+        os_dep.c.  It relies on threads to track writes. */
+#    ifdef GC_DARWIN_THREADS
+/* #       define MPROTECT_VDB -- diabled for now.  May work for some apps. */
+#    endif
+#    include <unistd.h>
+#    define GETPAGESIZE() getpagesize()
+      /* There seems to be some issues with trylock hanging on darwin. This
+         should be looked into some more */
+#     define NO_PTHREAD_TRYLOCK
+#   elif defined(__arm__)
+#    define ARM
+#    define mach_type_known
+#    define DARWIN_DONT_PARSE_STACK
 #   endif
 # endif
 # if defined(NeXT) && defined(mc68000)
 #   define I386
 #   define mach_type_known
 # endif
+# if defined(FREEBSD) && defined(__x86_64__)
+#   define X86_64
+#   define mach_type_known
+# endif
 # if defined(__NetBSD__) && (defined(i386) || defined(__i386__))
 #   define I386
 #   define mach_type_known
 # else
 #   if (defined(_MSDOS) || defined(_MSC_VER)) && (_M_IX86 >= 300) \
         || defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__)
-#     define I386
-#     define MSWIN32   /* or Win32s */
-#     define mach_type_known
-#   endif
-#   if defined(_MSC_VER) && defined(_M_IA64)
-#     define IA64
-#     define MSWIN32   /* Really win64, but we don't treat 64-bit      */
-                       /* variants as a differnt platform.             */
+#     if defined(__LP64__) || defined(_WIN64)\r
+#      define X86_64\r
+#     else\r
+#       define I386\r
+#     endif\r
+#     define MSWIN32   /* or Win64 */\r
+#     define mach_type_known\r
+#   endif\r
+#   if defined(_MSC_VER) && defined(_M_IA64)\r
+#     define IA64\r
+#     define MSWIN32   /* Really win64, but we don't treat 64-bit      */\r
+                       /* variants as a differnt platform.             */\r
 #   endif
 # endif
 # if defined(__DJGPP__)
 #     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)
+#     include <features.h>
+#     if defined(__GLIBC__) && __GLIBC__ >= 2
+#       define SEARCH_FOR_DATA_START
 #     else
-#       define DATASTART GC_SysVGetDataStart(0x10000, _etext)
+          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)
 #     define LINUX_STACKBOTTOM
 #   endif
 #   ifdef OPENBSD
 #           include <features.h>
 #           if defined(__GLIBC__) && __GLIBC__ >= 2
 #               define SEARCH_FOR_DATA_START
+#           elif defined(PLATFORM_ANDROID)
+#               define SEARCH_FOR_DATA_START
 #           else
                 extern char **__environ;
 #                define DATASTART ((ptr_t)(&__environ))
 #     define OS_TYPE "MSWINCE"
 #     define DATAEND /* not needed */
 #   endif
+#   ifdef DARWIN
+#     define OS_TYPE "DARWIN"
+#     define DATASTART ((ptr_t) get_etext())
+#     define DATAEND   ((ptr_t) get_end())
+#     define STACKBOTTOM ((ptr_t) 0x30000000)
+#     define USE_MMAP
+#     define USE_MMAP_ANON
+#     define USE_MUNMAP
+#   endif
 #   ifdef NOSYS
       /* __data_start is usually defined in the target linker script.  */
       extern int __data_start[];
 #          define PREFETCH_FOR_WRITE(x) __builtin_prefetch((x), 1)
 #      endif
 #   endif
+#   ifdef FREEBSD
+#      define OS_TYPE "FREEBSD"
+#      ifndef GC_FREEBSD_THREADS
+#          define MPROTECT_VDB
+#      endif
+#      define SIG_SUSPEND SIGTSTP
+#      define SIG_THR_RESTART SIGCONT
+#      define NEED_FIND_LIMIT
+#      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__