aboutsummaryrefslogtreecommitdiff
path: root/sys/amd64
diff options
context:
space:
mode:
authorJulian Elischer <julian@FreeBSD.org>1999-04-05 19:38:30 +0000
committerJulian Elischer <julian@FreeBSD.org>1999-04-05 19:38:30 +0000
commit8d17e69460958f683941c24ad375d150dc3bcb5c (patch)
tree5be7194389af7a604e5882afafda60102372c096 /sys/amd64
parent7b9e192e2899e95963a272001c377c5caedd20fc (diff)
downloadsrc-8d17e69460958f683941c24ad375d150dc3bcb5c.tar.gz
src-8d17e69460958f683941c24ad375d150dc3bcb5c.zip
Catch a case spotted by Tor where files mmapped could leave garbage in the
unallocated parts of the last page when the file ended on a frag but not a page boundary. Delimitted by tags PRE_MATT_MMAP_EOF and POST_MATT_MMAP_EOF, in files alpha/alpha/pmap.c i386/i386/pmap.c nfs/nfs_bio.c vm/pmap.h vm/vm_page.c vm/vm_page.h vm/vnode_pager.c miscfs/specfs/spec_vnops.c ufs/ufs/ufs_readwrite.c kern/vfs_bio.c Submitted by: Matt Dillon <dillon@freebsd.org> Reviewed by: Alan Cox <alc@freebsd.org>
Notes
Notes: svn path=/head/; revision=45347
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/pmap.c60
1 files changed, 55 insertions, 5 deletions
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index ec6c00c854f9..c630306eb06f 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
* from: @(#)pmap.c 7.7 (Berkeley) 5/12/91
- * $Id: pmap.c,v 1.225 1999/03/13 07:31:29 alc Exp $
+ * $Id: pmap.c,v 1.226 1999/04/02 17:59:38 alc Exp $
*/
/*
@@ -2818,10 +2818,8 @@ pmap_kernel()
}
/*
- * pmap_zero_page zeros the specified (machine independent)
- * page by mapping the page into virtual memory and using
- * bzero to clear its contents, one machine dependent page
- * at a time.
+ * pmap_zero_page zeros the specified hardware page by mapping
+ * the page into KVM and using bzero to clear its contents.
*/
void
pmap_zero_page(phys)
@@ -2868,6 +2866,58 @@ pmap_zero_page(phys)
}
/*
+ * pmap_zero_page_area zeros the specified hardware page by mapping
+ * the page into KVM and using bzero to clear its contents.
+ *
+ * off and size may not cover an area beyond a single hardware page.
+ */
+void
+pmap_zero_page_area(phys, off, size)
+ vm_offset_t phys;
+ int off;
+ int size;
+{
+#ifdef SMP
+#if !defined(MAX_PERF)
+ if (*(int *) prv_CMAP3)
+ panic("pmap_zero_page: prv_CMAP3 busy");
+#endif
+
+ *(int *) prv_CMAP3 = PG_V | PG_RW | (phys & PG_FRAME) | PG_A | PG_M;
+ cpu_invlpg(&prv_CPAGE3);
+
+#if defined(I686_CPU)
+ if (cpu_class == CPUCLASS_686 && off == 0 && size == PAGE_SIZE)
+ i686_pagezero(&prv_CPAGE3);
+ else
+#endif
+ bzero((char *)&prv_CPAGE3 + off, size);
+
+ *(int *) prv_CMAP3 = 0;
+#else
+#if !defined(MAX_PERF)
+ if (*(int *) CMAP2)
+ panic("pmap_zero_page: CMAP2 busy");
+#endif
+
+ *(int *) CMAP2 = PG_V | PG_RW | (phys & PG_FRAME) | PG_A | PG_M;
+ if (cpu_class == CPUCLASS_386) {
+ invltlb();
+ } else {
+ invlpg((u_int)CADDR2);
+ }
+
+#if defined(I686_CPU)
+ if (cpu_class == CPUCLASS_686 && off == 0 && size == PAGE_SIZE)
+ i686_pagezero(CADDR2);
+ else
+#endif
+ bzero((char *)CADDR2 + off, size);
+ *(int *) CMAP2 = 0;
+#endif
+}
+
+/*
* pmap_copy_page copies the specified (machine independent)
* page by mapping the page into virtual memory and using
* bcopy to copy the page, one machine dependent page at a