svn commit: r327074 - in head/sys/mips: include mips

Konstantin Belousov kib at FreeBSD.org
Thu Dec 21 23:39:02 UTC 2017


Author: kib
Date: Thu Dec 21 23:39:00 2017
New Revision: 327074
URL: https://svnweb.freebsd.org/changeset/base/327074

Log:
  Fix mips build after introduction of MD definitions of atomic_load_64
  and atomic_store_64.
  
  The MD definitions are provided for LP64 only, while mips also uses
  them for 32bit and n32.  Only define mips variants for 32bit and n32
  and change the syntax to match common definitions.
  
  Note that this commit does not fix 32bit asm implementation to follow
  new KBI, this will be fixed later.  The functions are only used for 8
  byte ddb accesses so the known bug does not prevent normal kernel
  operations.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/mips/include/atomic.h
  head/sys/mips/mips/db_interface.c

Modified: head/sys/mips/include/atomic.h
==============================================================================
--- head/sys/mips/include/atomic.h	Thu Dec 21 23:08:10 2017	(r327073)
+++ head/sys/mips/include/atomic.h	Thu Dec 21 23:39:00 2017	(r327074)
@@ -342,20 +342,21 @@ atomic_store_rel_##WIDTH(__volatile uint##WIDTH##_t *p
 ATOMIC_STORE_LOAD(32)
 ATOMIC_STORE_LOAD(64)
 #if !defined(__mips_n64) && !defined(__mips_n32)
-void atomic_store_64(__volatile uint64_t *, uint64_t *);
-void atomic_load_64(__volatile uint64_t *, uint64_t *);
-#else
+void atomic_store_64(__volatile uint64_t *, uint64_t);
+uint64_t atomic_load_64(__volatile uint64_t *);
+#elif defined (__mips_n32)
 static __inline void
-atomic_store_64(__volatile uint64_t *p, uint64_t *v)
+atomic_store_64(__volatile uint64_t *p, uint64_t v)
 {
-	*p = *v;
+	*p = v;
 }
 
-static __inline void
-atomic_load_64(__volatile uint64_t *p, uint64_t *v)
+static __inline uint64_t
+atomic_load_64(__volatile uint64_t *p)
 {
-	*v = *p;
+	return (*p);
 }
+/* #else atomic_common.h definitions of atomic_load/store_64 are used */
 #endif
 
 #undef ATOMIC_STORE_LOAD

Modified: head/sys/mips/mips/db_interface.c
==============================================================================
--- head/sys/mips/mips/db_interface.c	Thu Dec 21 23:08:10 2017	(r327073)
+++ head/sys/mips/mips/db_interface.c	Thu Dec 21 23:39:00 2017	(r327074)
@@ -164,9 +164,9 @@ db_read_bytes(vm_offset_t addr, size_t size, char *dat
 				*(uint32_t *)data = *(uint32_t *)addr;
 				break;
 			case 8:
-				atomic_load_64((volatile u_int64_t *)addr,
-				    (u_int64_t *)data);
-			break;
+				*(uint64_t *)data = atomic_load_64(
+				    (void *)addr);
+				break;
 			}
 		} else {
 			char *src;
@@ -207,9 +207,9 @@ db_write_bytes(vm_offset_t addr, size_t size, char *da
 				*(uint32_t *)addr = *(uint32_t *)data;
 				break;
 			case 8:
-				atomic_store_64((volatile u_int64_t *)addr,
-				    (u_int64_t *)data);
-			break;
+				atomic_store_64((uint64_t *)addr,
+				    *(uint64_t *)data);
+				break;
 			}
 		} else {
 			char *dst;


More information about the svn-src-all mailing list