summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Therning <niklas@therning.org>2014-12-12 15:58:45 +0100
committerIvan Maidanski <ivmai@mail.ru>2015-03-13 01:01:09 +0300
commit0a8d46700a9d633ab8167c7781f314742630d186 (patch)
tree0287b0f4b22dc59aeeb2133043bc78a642a1f678
parentb51a05f39899bddbe97bb6a7ad86d15d6d0289d8 (diff)
downloadbdwgc-0a8d46700a9d633ab8167c7781f314742630d186.tar.gz
Initial support for iOS ARM64 (Aarch64)
* darwin_stop_world.c (GC_stack_range_for): Handle AARCH64 case. * include/private/gc_priv.h (GC_THREAD_STATE_T, GC_MACH_THREAD_STATE, GC_MACH_THREAD_STATE_COUNT): Define for AARCH64. * include/private/gcconfig.h (OS_TYPE, DYNAMIC_LOADING, DATASTART, DATAEND, STACKBOTTOM, USE_MMAP, USE_MMAP_ANON, MPROTECT_VDB, GETPAGESIZE, NO_PTHREAD_TRYLOCK, NO_DYLD_BIND_FULLY_IMAGE): Likewise. * include/private/gcconfig.h (AARCH64, mach_type_known, DARWIN_DONT_PARSE_STACK): Define for Darwin/AArch64.
-rw-r--r--darwin_stop_world.c40
-rw-r--r--include/private/gc_priv.h4
-rw-r--r--include/private/gcconfig.h29
3 files changed, 72 insertions, 1 deletions
diff --git a/darwin_stop_world.c b/darwin_stop_world.c
index fc747f53..3c4f85bc 100644
--- a/darwin_stop_world.c
+++ b/darwin_stop_world.c
@@ -278,6 +278,46 @@ STATIC ptr_t GC_stack_range_for(ptr_t *phi, thread_act_t thread, GC_thread p,
GC_push_one(state.THREAD_FLD(lr));
GC_push_one(state.THREAD_FLD(cpsr));
+# elif defined(AARCH64)
+ lo = (void *)state.__sp;
+# ifndef DARWIN_DONT_PARSE_STACK
+ *phi = GC_FindTopOfStack(state.__sp);
+# endif
+ GC_push_one(state.__x[0]);
+ GC_push_one(state.__x[1]);
+ GC_push_one(state.__x[2]);
+ GC_push_one(state.__x[3]);
+ GC_push_one(state.__x[4]);
+ GC_push_one(state.__x[5]);
+ GC_push_one(state.__x[6]);
+ GC_push_one(state.__x[7]);
+ GC_push_one(state.__x[8]);
+ GC_push_one(state.__x[9]);
+ GC_push_one(state.__x[10]);
+ GC_push_one(state.__x[11]);
+ GC_push_one(state.__x[12]);
+ GC_push_one(state.__x[13]);
+ GC_push_one(state.__x[14]);
+ GC_push_one(state.__x[15]);
+ GC_push_one(state.__x[16]);
+ GC_push_one(state.__x[17]);
+ GC_push_one(state.__x[18]);
+ GC_push_one(state.__x[19]);
+ GC_push_one(state.__x[20]);
+ GC_push_one(state.__x[21]);
+ GC_push_one(state.__x[22]);
+ GC_push_one(state.__x[23]);
+ GC_push_one(state.__x[24]);
+ GC_push_one(state.__x[25]);
+ GC_push_one(state.__x[26]);
+ GC_push_one(state.__x[27]);
+ GC_push_one(state.__x[28]);
+ GC_push_one(state.__fp);
+ GC_push_one(state.__lr);
+ /* GC_push_one(state.__sp); */
+ /* GC_push_one(state.__pc); */
+ /* GC_push_one(state.__cpsr); */
+
# else
# error FIXME for non-x86 || ppc || arm architectures
# endif
diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h
index c4751d9b..ffbcc5ba 100644
--- a/include/private/gc_priv.h
+++ b/include/private/gc_priv.h
@@ -596,6 +596,10 @@ GC_EXTERN GC_warn_proc GC_current_warn_proc;
# define GC_MACH_THREAD_STATE ARM_MACHINE_THREAD_STATE
# define GC_MACH_THREAD_STATE_COUNT ARM_MACHINE_THREAD_STATE_COUNT
# endif
+# elif defined(AARCH64)
+# define GC_THREAD_STATE_T arm_thread_state64_t
+# define GC_MACH_THREAD_STATE ARM_THREAD_STATE64
+# define GC_MACH_THREAD_STATE_COUNT ARM_THREAD_STATE64_COUNT
# else
# error define GC_THREAD_STATE_T
# endif
diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h
index 989a7343..e5df5c09 100644
--- a/include/private/gcconfig.h
+++ b/include/private/gcconfig.h
@@ -97,7 +97,7 @@
# endif
# if defined(__aarch64__)
# define AARCH64
-# if !defined(LINUX)
+# if !defined(LINUX) && !defined(DARWIN)
# define NOSYS
# define mach_type_known
# endif
@@ -372,6 +372,10 @@
# define ARM32
# define mach_type_known
# define DARWIN_DONT_PARSE_STACK
+# elif defined(__aarch64__)
+# define AARCH64
+# define mach_type_known
+# define DARWIN_DONT_PARSE_STACK
# endif
# endif
# if defined(__rtems__) && (defined(i386) || defined(__i386__))
@@ -2040,6 +2044,29 @@
extern char _end[];
# define DATAEND ((ptr_t)(&_end))
# endif
+# ifdef DARWIN
+ /* iOS */
+# define OS_TYPE "DARWIN"
+# ifndef GC_DONT_REGISTER_MAIN_STATIC_DATA
+# define DYNAMIC_LOADING
+# endif
+# define DATASTART ((ptr_t) get_etext())
+# define DATAEND ((ptr_t) get_end())
+# define STACKBOTTOM ((ptr_t) 0x16fdfffff)
+# ifndef USE_MMAP
+# define USE_MMAP
+# endif
+# define USE_MMAP_ANON
+# define MPROTECT_VDB
+# include <unistd.h>
+# define GETPAGESIZE() getpagesize()
+ /* FIXME: There seems to be some issues with trylock hanging on */
+ /* darwin. This should be looked into some more. */
+# define NO_PTHREAD_TRYLOCK
+# ifndef NO_DYLD_BIND_FULLY_IMAGE
+# define NO_DYLD_BIND_FULLY_IMAGE
+# endif
+# endif
# ifdef NOSYS
/* __data_start is usually defined in the target linker script. */
extern int __data_start[];