From 03f8528315fa46c95991a34f3325d7b33ae5538c Mon Sep 17 00:00:00 2001
From: Edward Rudd <urkle@outoforder.cc>
Date: Sat, 02 May 2020 21:48:36 +0000
Subject: [PATCH] Update source to SDL2 2.0.12

---
 source/src/atomic/SDL_spinlock.c |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/source/src/atomic/SDL_spinlock.c b/source/src/atomic/SDL_spinlock.c
index 6a7b14a..aa8ae57 100644
--- a/source/src/atomic/SDL_spinlock.c
+++ b/source/src/atomic/SDL_spinlock.c
@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+  Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -30,6 +30,10 @@
 
 #if !defined(HAVE_GCC_ATOMICS) && defined(__SOLARIS__)
 #include <atomic.h>
+#endif
+
+#if !defined(HAVE_GCC_ATOMICS) && defined(__RISCOS__)
+#include <unixlib/local.h>
 #endif
 
 #if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
@@ -79,10 +83,21 @@
     return (__sync_lock_test_and_set(lock, 1) == 0);
 
 #elif defined(__GNUC__) && defined(__arm__) && \
-        (defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) || \
+        (defined(__ARM_ARCH_3__) || defined(__ARM_ARCH_3M__) || \
+         defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) || \
          defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5TE__) || \
          defined(__ARM_ARCH_5TEJ__))
     int result;
+
+#if defined(__RISCOS__)
+    if (__cpucap_have_rex()) {
+        __asm__ __volatile__ (
+            "ldrex %0, [%2]\nteq   %0, #0\nstrexeq %0, %1, [%2]"
+            : "=&r" (result) : "r" (1), "r" (lock) : "cc", "memory");
+        return (result == 0);
+    }
+#endif
+
     __asm__ __volatile__ (
         "swp %0, %1, [%2]\n"
         : "=&r,&r" (result) : "r,0" (1), "r,r" (lock) : "memory");

--
Gitblit v1.9.3