Define PMAP_NEED_PROCWR and provide pmap_procwr so that the i-cache is

synchronised with the d-cache appropriately.
This commit is contained in:
skrll 2011-12-23 16:35:00 +00:00
parent 209e832a68
commit ef7ea2cdf4
2 changed files with 19 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.83 2011/12/16 12:45:04 skrll Exp $ */
/* $NetBSD: pmap.c,v 1.84 2011/12/23 16:35:00 skrll Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.83 2011/12/16 12:45:04 skrll Exp $");
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.84 2011/12/23 16:35:00 skrll Exp $");
#include "opt_cputype.h"
@ -1587,6 +1587,18 @@ pmap_activate(struct lwp *l)
mtctl(pmap->pm_pid, CR_PIDR2);
}
void
pmap_procwr(struct proc *p, vaddr_t va, size_t len)
{
pmap_t pmap = p->p_vmspace->vm_map.pmap;
fdcache(pmap->pm_space, va, len);
sync_caches();
ficache(pmap->pm_space, va, len);
sync_caches();
}
static inline void
pmap_flush_page(struct vm_page *pg, bool purge)
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.h,v 1.32 2011/12/16 13:38:44 skrll Exp $ */
/* $NetBSD: pmap.h,v 1.33 2011/12/23 16:35:00 skrll Exp $ */
/* $OpenBSD: pmap.h,v 1.35 2007/12/14 18:32:23 deraadt Exp $ */
@ -48,6 +48,8 @@
#ifdef _KERNEL
#define PMAP_NEED_PROCWR
struct pmap {
struct uvm_object pm_obj; /* object (lck by object lock) */
#define pm_lock pm_obj.vmobjlock
@ -148,6 +150,8 @@ void pmap_write_protect(struct pmap *, vaddr_t, vaddr_t, vm_prot_t);
void pmap_remove(struct pmap *pmap, vaddr_t sva, vaddr_t eva);
void pmap_page_remove(struct vm_page *pg);
void pmap_procwr(struct proc *, vaddr_t, size_t);
static inline void
pmap_deactivate(struct lwp *l)
{