]> Chaos Git - corbenik/ctrulib.git/commitdiff
Move __clrex/__ldrex/__strex to synchronization.h
authorfincs <fincs.alt1@gmail.com>
Tue, 29 Sep 2015 22:20:05 +0000 (00:20 +0200)
committerfincs <fincs.alt1@gmail.com>
Tue, 29 Sep 2015 22:20:05 +0000 (00:20 +0200)
libctru/include/3ds/synchronization.h
libctru/source/synchronization.c

index 4a217348048cbaee14db29b76934722dfe8bb616..e235e08db41be96922eb64d766d6d7667c65095b 100644 (file)
@@ -9,6 +9,25 @@ typedef struct
        u32 counter;
 } RecursiveLock;
 
+static inline void __clrex(void)
+{
+       __asm__ __volatile__("clrex");
+}
+
+static inline s32 __ldrex(s32* addr)
+{
+       s32 val;
+       __asm__ __volatile__("ldrex %[val], %[addr]" : [val] "=r" (val) : [addr] "Q" (*addr));
+       return val;
+}
+
+static inline bool __strex(s32* addr, s32 val)
+{
+       bool res;
+       __asm__ __volatile__("strex %[res], %[val], %[addr]" : [res] "=&r" (res) : [val] "r" (val), [addr] "Q" (*addr));
+       return res;
+}
+
 void LightLock_Init(LightLock* lock);
 void LightLock_Lock(LightLock* lock);
 void LightLock_Unlock(LightLock* lock);
index 99cdb26fd87385274568a4f1d141986797e97877..1055c061f57c8b4aa6a196f3cf8580fdd58f4c3e 100644 (file)
@@ -16,25 +16,6 @@ void __sync_fini(void)
                svcCloseHandle(arbiter);
 }
 
-static inline void __clrex(void)
-{
-       __asm__ __volatile__("clrex");
-}
-
-static inline s32 __ldrex(s32* addr)
-{
-       s32 val;
-       __asm__ __volatile__("ldrex %[val], [%[addr]]" : [val] "=r" (val) : [addr] "r" (addr));
-       return val;
-}
-
-static inline bool __strex(s32* addr, s32 val)
-{
-       bool res;
-       __asm__ __volatile__("strex %[res], %[val], [%[addr]]" : [res] "=&r" (res) : [val] "r" (val), [addr] "r" (addr));
-       return res;
-}
-
 void LightLock_Init(LightLock* lock)
 {
        do