]> granicus.if.org Git - gc/commitdiff
NaCl ARM work, first pass
authorElijah Taylor <elijahtaylor@google.com>
Thu, 31 Jan 2013 22:00:58 +0000 (14:00 -0800)
committerIvan Maidanski <ivmai@mail.ru>
Sun, 15 Sep 2013 09:00:21 +0000 (13:00 +0400)
include/private/gc_locks.h
include/private/gcconfig.h
pthread_stop_world.c

index 8705d07a1bbc072365c40381008c9e178821eea3..80712fcdf3f597637aed10d181d2642af72c8917 100644 (file)
 #       define GC_CLEAR_DEFINED
 #    endif /* ALPHA */
 #    ifdef ARM32
+#ifdef __native_client__
+#define NACL_ALIGN() ".align 4\n"
+#define MASK_REGISTER(reg) "bic " reg ", " reg ", #0xc0000000\n"
+#else
+#define NACL_ALIGN()
+#define MASK_REGISTER(reg)
+#endif
         inline static int GC_test_and_set(volatile unsigned int *addr) {
 #if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7__)
           int ret, tmp;
           __asm__ __volatile__ (
                                  "1:\n"
+                                 NACL_ALIGN()
+                                 MASK_REGISTER("%3")
                                  "ldrex %0, [%3]\n"
+                                 MASK_REGISTER("%3")
                                  "strex %1, %2, [%3]\n" 
                                  "teq %1, #0\n"
                                  "bne 1b\n"
            * bus because there are no SMP ARM machines.  If/when there are,
            * this code will likely need to be updated. */
           /* See linuxthreads/sysdeps/arm/pt-machine.h in glibc-2.1 */
-          __asm__ __volatile__("swp %0, %1, [%2]"
+          __asm__ __volatile__(MASK_REGISTER("%2")
+                               "swp %0, %1, [%2]"
                             : "=&r"(oldval)
                             : "r"(1), "r"(addr)
                             : "memory");
index 49ffccddf505b1680240cce5069929abae02ebd8..88e783800de9faf427837c7bd93a1b3bd15f99cd 100644 (file)
@@ -76,7 +76,9 @@
 # endif
 # if defined(__arm__) || defined(__thumb__)
 #    define ARM32
-#    if !defined(LINUX) && !defined(NETBSD) && !defined(DARWIN)
+#    if defined(NACL)
+#      define mach_type_known
+#    elif !defined(LINUX) && !defined(NETBSD) && !defined(DARWIN)
 #      define NOSYS
 #      define mach_type_known
 #    endif
 # endif
 
 # ifdef ARM32
-#   define CPP_WORDSZ 32
+# if defined( NACL )
+#   define MACH_TYPE "NACL"
+# else
 #   define MACH_TYPE "ARM32"
+# endif
+#   define CPP_WORDSZ 32
 #   define ALIGNMENT 4
 #   ifdef NETBSD
 #       define OS_TYPE "NETBSD"
index 8b25376b54ab6d691176ba61f0d7345c6b5c1ab6..fe2ba1a381025cf22af5cf92b04d45bf44600ad9 100644 (file)
@@ -537,6 +537,22 @@ static void pthread_stop_world()
        __asm__ __volatile__ ("add $16, %esp");\
     } while (0)
 
+#elif __arm__
+
+#define NACL_STORE_REGS()  \
+    do {                  \
+       __asm__ __volatile__ ("push {r4-r12,lr}");\
+       __asm__ __volatile__ ("mov r0, %0" : : "r" (&nacl_gc_thread_self->stop_info.stack_ptr)); \
+       __asm__ __volatile__ ("bic r0, r0, #0xc0000000");\
+       __asm__ __volatile__ ("str sp, [r0]");\
+       memcpy(nacl_gc_thread_self->stop_info.reg_storage, nacl_gc_thread_self->stop_info.stack_ptr, NACL_GC_REG_STORAGE_SIZE * sizeof(ptr_t));\
+       __asm__ __volatile__ ("add sp, sp, #40");\
+       __asm__ __volatile__ ("bic sp, sp, #0xc0000000");\
+    } while (0)
+#else
+
+#error "Please port NACL_STORE_REGS"
+
 #endif
 
 void nacl_pre_syscall_hook()