php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #53310
Patch fpm_atomics_sparc_v8.patch revision 2010-11-15 02:04 UTC by stefan at whocares dot de

Patch fpm_atomics_sparc_v8.patch for FPM related Bug #53310

Patch version 2010-11-15 02:04 UTC

Return to Bug #53310 | Download this patch
Patch Revisions:

Developer: stefan@whocares.de

--- fpm_atomic.h.org	2009-12-14 09:18:53.000000000 +0000
+++ fpm_atomic.h	2010-11-15 01:50:31.000000000 +0000
@@ -82,7 +82,7 @@
 #endif /* defined (__GNUC__) &&... */
 
 #elif ( __sparc__ || __sparc ) /* Marcin Ochab */
-
+#if (__sparc_v9__)
 #if (__arch64__ || __arch64)
 typedef uint64_t                    atomic_uint_t;
 typedef volatile atomic_uint_t      atomic_t;
@@ -118,7 +118,23 @@
 }
 /* }}} */
 #endif
+#else /* sparcv9 */
+typedef uint32_t                    atomic_uint_t;
+typedef volatile atomic_uint_t      atomic_t;
 
+static inline int atomic_cas_32(atomic_t *lock) /* {{{ */
+{
+	        register atomic_uint_t _res;
+		        __asm__ __volatile__("ldstub [%2], %0" : "=r"(_res), "+m"(*lock) : "r"(lock) : "memory");
+			        return (int) _res;
+}
+/* }}} */
+
+static inline atomic_uint_t atomic_cmp_set(atomic_t *lock, atomic_uint_t old, atomic_uint_t set) /* {{{ */
+{
+	        return (atomic_cas_32(lock)==0);
+}
+/* }}} */
 #else
 
 #error unsupported processor. please write a patch and send it to me

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 17:01:58 2024 UTC