[PATCH] Add DRM_CAS for mips32
Aleksey Kuleshov
rndfax at yandex.ru
Thu May 14 05:12:20 PDT 2015
Signed-off-by: Aleksey Kuleshov <rndfax at yandex.ru>
---
xf86drm.h | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/xf86drm.h b/xf86drm.h
index 40c55c9..2ba75d9 100644
--- a/xf86drm.h
+++ b/xf86drm.h
@@ -462,6 +462,27 @@ do { register unsigned int __old __asm("o0"); \
: "cr0", "memory"); \
} while (0)
+#elif defined(__mips__)
+
+#define DRM_CAS(lock, old, new, ret) \
+ do { \
+ int tmp; \
+ asm volatile( \
+ ".set push;" \
+ ".set noreorder;" \
+ ".set mips32;" \
+ "ll %[_tmp], %[_lock];" \
+ "bne %[_tmp], %[_old], 1f;" \
+ "li %[_ret], 1;" \
+ "sc %[_new], %[_lock];" \
+ "xori %[_ret], %[_new], 1;" \
+ "1:" \
+ ".set pop;" \
+ : [_lock] "=m" (__drm_dummy_lock(lock)), \
+ [_tmp] "=&r" (tmp), [_ret] "=&r" (ret) \
+ : [_old] "r" (old), [_new] "r" (new)); \
+ } while (0)
+
#endif /* architecture */
#endif /* __GNUC__ >= 2 */
@@ -471,7 +492,7 @@ do { register unsigned int __old __asm("o0"); \
#if defined(__alpha__)
#define DRM_CAS_RESULT(_result) long _result
-#elif defined(__powerpc__)
+#elif defined(__powerpc__) || defined(__mips__)
#define DRM_CAS_RESULT(_result) int _result
#else
#define DRM_CAS_RESULT(_result) char _result
--
2.1.4
More information about the dri-devel
mailing list