summaryrefslogtreecommitdiff
path: root/package/libdrm/patches/patch-xf86drm_h
blob: aa3f49cca059f5554fb4eb6467ebcff59b65cd38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
	Fix for lemote.
--- libdrm-2.4.20.orig/xf86drm.h	2010-03-06 00:21:13.000000000 +0100
+++ libdrm-2.4.20/xf86drm.h	2010-06-12 20:43:01.324916826 +0200
@@ -374,6 +374,29 @@ typedef struct _drmSetVersion {
 		: "memory");			\
 	} while (0)
 
+#elif defined(__mips__)
+
+#define DRM_CAS(lock, old, new, ret)            \
+	do {                                    \
+		__asm__ __volatile__(           \
+		"	.set mips3;.set noreorder;\n" \
+		"	sync; \n"               \
+		"	ll   %1, %0;\n"         \
+		"	bne  %1, %2, 1f;\n"     \
+		"	 li   %1, 1; \n"        \
+		"	move %1, %3; \n"        \
+		"	sc    %1, %0;\n"        \
+		"	xori   %1, %1, 1\n"     \
+		"1:	\n"                     \
+		"	.set mips0; .set reorder;\n" \
+		: "=m" (__drm_dummy_lock(lock)),\
+		  "=&r" (ret)                   \
+		: "r" (old),                    \
+		  "r" (new)                     \
+		: "memory","$8"                 \
+		);                              \
+	} while(0)
+
 #elif defined(__sparc__)
 
 #define DRM_CAS(lock,old,new,__ret)				\
@@ -457,7 +480,7 @@ do {	register unsigned int __old __asm("
 
 #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