[haiku-commits] haiku: hrev46936 - headers/private/kernel/arch/arm src/system/libroot/os/arch/arm

  • From: kallisti5@xxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 26 Feb 2014 19:52:12 +0100 (CET)

hrev46936 adds 1 changeset to branch 'master'
old head: cb7de03cca0bf9633f203be9a1bee89b50aa4813
new head: a21611e4394a9506d0d1b22bbde47cfe291a25cf
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=a21611e+%5Ecb7de03

----------------------------------------------------------------------------

a21611e: ARM: Add ARMv6 or older __sync_synchronize built-in
  
  * On ARMv6 or older, we do a simulated dsb.
  * Move __sync_synchronize into thread.c in libroot
    and use the new arch_atomic.h dsb/dmb defines.
  * Gets arm @bootstrap-raw to end of bootstrap.

                          [ Alexander von Gluck IV <kallisti5@xxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev46936
Commit:      a21611e4394a9506d0d1b22bbde47cfe291a25cf
URL:         http://cgit.haiku-os.org/haiku/commit/?id=a21611e
Author:      Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date:        Wed Feb 26 18:49:38 2014 UTC

----------------------------------------------------------------------------

3 files changed, 41 insertions(+), 16 deletions(-)
headers/private/kernel/arch/arm/arch_atomic.h | 24 +++++++++++++++++------
src/system/libroot/os/arch/arm/atomic.S       | 11 +----------
src/system/libroot/os/arch/arm/thread.c       | 22 +++++++++++++++++++++

----------------------------------------------------------------------------

diff --git a/headers/private/kernel/arch/arm/arch_atomic.h 
b/headers/private/kernel/arch/arm/arch_atomic.h
index db12cad..50b4bb7 100644
--- a/headers/private/kernel/arch/arm/arch_atomic.h
+++ b/headers/private/kernel/arch/arm/arch_atomic.h
@@ -9,29 +9,41 @@
 #define _KERNEL_ARCH_ARM_ATOMIC_H
 
 
+#if __ARM_ARCH__ <= 6
+#define dsb() __asm__ __volatile__("mcr p15, 0, %0, c7, c10, 4" \
+    : : "r" (0) : "memory")
+#define dmb() __asm__ __volatile__("mcr p15, 0, %0, c7, c10, 4" \
+    : : "r" (0) : "memory")
+#else
+#define dsb() __asm__ __volatile__("dsb" : : : "memory")
+#define dmb() __asm__ __volatile__("dmb" : : : "memory")
+#endif
+
+
 static inline void
 memory_read_barrier_inline(void)
 {
-       asm volatile ("":::"memory");
+       dmb();
 }
 
 
 static inline void
 memory_write_barrier_inline(void)
 {
-       asm volatile ("":::"memory");
+       dmb();
 }
 
 
 static inline void
 memory_full_barrier_inline(void)
 {
-       asm volatile ("":::"memory");
+       dmb();
 }
 
 
-#define memory_read_barrier    memory_read_barrier_inline
-#define memory_write_barrier   memory_write_barrier_inline
-#define memory_full_barrier    memory_full_barrier_inline
+#define memory_read_barrier memory_read_barrier_inline
+#define memory_write_barrier memory_write_barrier_inline
+#define memory_full_barrier memory_full_barrier_inline
+
 
 #endif // _KERNEL_ARCH_ARM_ATOMIC_H
diff --git a/src/system/libroot/os/arch/arm/atomic.S 
b/src/system/libroot/os/arch/arm/atomic.S
index 31068b2..5728e5c 100644
--- a/src/system/libroot/os/arch/arm/atomic.S
+++ b/src/system/libroot/os/arch/arm/atomic.S
@@ -6,6 +6,7 @@
 #include <asm_defs.h>
 #include <arch_config.h>
 
+
 .text
 
 #ifndef ATOMIC_FUNCS_ARE_SYSCALLS
@@ -22,9 +23,6 @@ miss1:                ldrex       r12, [r0]
                bx          lr
 FUNCTION_END(atomic_add)
 
-
-
-
 /* int atomic_and(int *value, int andValue)
  */
 FUNCTION(atomic_and):
@@ -88,13 +86,6 @@ FUNCTION(atomic_get):
         bx     lr
 FUNCTION_END(atomic_get)
 
-/* void __sync_synchronize(void)
- */
-FUNCTION(__sync_synchronize):
-       dmb
-       bx lr
-FUNCTION_END(__sync_synchronize)
-
 #endif /* ATOMIC_FUNCS_ARE_SYSCALLS */
 
 #ifndef ATOMIC64_FUNCS_ARE_SYSCALLS
diff --git a/src/system/libroot/os/arch/arm/thread.c 
b/src/system/libroot/os/arch/arm/thread.c
index df90b6a..cb233d4 100644
--- a/src/system/libroot/os/arch/arm/thread.c
+++ b/src/system/libroot/os/arch/arm/thread.c
@@ -1,4 +1,16 @@
+/*
+ * Copyright 2012-2014, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *             Jerome Duval <jerome.duval@xxxxxxx>
+ *             Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
+ */
+
+
 #include <OS.h>
+
+#include <arch_atomic.h>
 #include "syscalls.h"
 
 
@@ -7,3 +19,13 @@ find_thread(const char *name)
 {
        return _kern_find_thread(name);
 }
+
+
+/*
+ * Fill out gcc __sync_synchronize built-in for ARM
+ */
+void
+__sync_synchronize(void)
+{
+       dsb();
+}


Other related posts:

  • » [haiku-commits] haiku: hrev46936 - headers/private/kernel/arch/arm src/system/libroot/os/arch/arm - kallisti5