svn commit: r321363 - in stable/10/sys: amd64/amd64 i386/i386

Alan Cox alc at FreeBSD.org
Sat Jul 22 06:40:59 UTC 2017


Author: alc
Date: Sat Jul 22 06:40:57 2017
New Revision: 321363
URL: https://svnweb.freebsd.org/changeset/base/321363

Log:
  MFC r320546
    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.

Modified:
  stable/10/sys/amd64/amd64/pmap.c
  stable/10/sys/i386/i386/pmap.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/amd64/pmap.c
==============================================================================
--- stable/10/sys/amd64/amd64/pmap.c	Sat Jul 22 06:36:27 2017	(r321362)
+++ stable/10/sys/amd64/amd64/pmap.c	Sat Jul 22 06:40:57 2017	(r321363)
@@ -1807,7 +1807,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: stable/10/sys/i386/i386/pmap.c
==============================================================================
--- stable/10/sys/i386/i386/pmap.c	Sat Jul 22 06:36:27 2017	(r321362)
+++ stable/10/sys/i386/i386/pmap.c	Sat Jul 22 06:40:57 2017	(r321363)
@@ -1245,7 +1245,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-all mailing list