Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Apr 2017 21:44:14 +0000 (UTC)
From:      Olivier Houchard <cognet@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r316691 - head/sys/mips/mips
Message-ID:  <201704102144.v3ALiExG061567@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cognet
Date: Mon Apr 10 21:44:13 2017
New Revision: 316691
URL: https://svnweb.freebsd.org/changeset/base/316691

Log:
  Provide some kind of __sync_bool_compare_and_swap_4(), as it is used by CK,
  and our gcc is too ancient to provide it.
  This should fix the build on mips.

Modified:
  head/sys/mips/mips/stdatomic.c

Modified: head/sys/mips/mips/stdatomic.c
==============================================================================
--- head/sys/mips/mips/stdatomic.c	Mon Apr 10 21:26:37 2017	(r316690)
+++ head/sys/mips/mips/stdatomic.c	Mon Apr 10 21:44:13 2017	(r316691)
@@ -287,8 +287,8 @@ EMIT_BITWISE_FETCH_AND_OP_N(2, uint16_t,
  * 32-bit routines.
  */
 
-uint32_t
-__sync_val_compare_and_swap_4(uint32_t *mem, uint32_t expected,
+static __inline uint32_t
+do_compare_and_swap_4(uint32_t *mem, uint32_t expected,
     uint32_t desired)
 {
 	uint32_t old, temp;
@@ -307,6 +307,23 @@ __sync_val_compare_and_swap_4(uint32_t *
 	return (old);
 }
 
+uint32_t
+__sync_val_compare_and_swap_4(uint32_t *mem, uint32_t expected,
+    uint32_t desired)
+{
+
+	return (do_compare_and_swap_4(mem, expected, desired));
+}
+
+bool
+__sync_bool_compare_and_swap_4(uint32_t *mem, uint32_t expected,
+    uint32_t desired)
+{
+
+	return (do_compare_and_swap_4(mem, expected, desired) ==
+	    desired);
+}
+
 #define	EMIT_FETCH_AND_OP_4(name, op)					\
 uint32_t								\
 __sync_##name##_4(uint32_t *mem, uint32_t val)				\



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201704102144.v3ALiExG061567>