svn commit: r320546 - in head/sys: amd64/amd64 i386/i386

Alan Cox alc at FreeBSD.org
Sat Jul 1 16:42:11 UTC 2017


Author: alc
Date: Sat Jul  1 16:42:09 2017
New Revision: 320546
URL: https://svnweb.freebsd.org/changeset/base/320546

Log:
  When "force" is specified to pmap_invalidate_cache_range(), the given
  start address is not required to be page aligned.  However, the loop
  within pmap_invalidate_cache_range() that performs the actual cache
  line invalidations requires that the starting address be truncated to
  a multiple of the cache line size.  This change corrects an error in
  that truncation.
  
  Submitted by:	Brett Gutstein <bgutstein at rice.edu>
  Reviewed by:	kib
  MFC after:	1 week

Modified:
  head/sys/amd64/amd64/pmap.c
  head/sys/i386/i386/pmap.c

Modified: head/sys/amd64/amd64/pmap.c
==============================================================================
--- head/sys/amd64/amd64/pmap.c	Sat Jul  1 15:58:57 2017	(r320545)
+++ head/sys/amd64/amd64/pmap.c	Sat Jul  1 16:42:09 2017	(r320546)
@@ -1868,7 +1868,7 @@ pmap_invalidate_cache_range(vm_offset_t sva, vm_offset
 {
 
 	if (force) {
-		sva &= ~(vm_offset_t)cpu_clflush_line_size;
+		sva &= ~(vm_offset_t)(cpu_clflush_line_size - 1);
 	} else {
 		KASSERT((sva & PAGE_MASK) == 0,
 		    ("pmap_invalidate_cache_range: sva not page-aligned"));

Modified: head/sys/i386/i386/pmap.c
==============================================================================
--- head/sys/i386/i386/pmap.c	Sat Jul  1 15:58:57 2017	(r320545)
+++ head/sys/i386/i386/pmap.c	Sat Jul  1 16:42:09 2017	(r320546)
@@ -1289,7 +1289,7 @@ pmap_invalidate_cache_range(vm_offset_t sva, vm_offset
 {
 
 	if (force) {
-		sva &= ~(vm_offset_t)cpu_clflush_line_size;
+		sva &= ~(vm_offset_t)(cpu_clflush_line_size - 1);
 	} else {
 		KASSERT((sva & PAGE_MASK) == 0,
 		    ("pmap_invalidate_cache_range: sva not page-aligned"));


More information about the svn-src-head mailing list