Implement pmap_remove_all().
This commit is contained in:
parent
07c5538d1f
commit
3a991d1e4a
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pmap.h,v 1.12 2008/01/23 19:46:45 bouyer Exp $ */
|
||||
/* $NetBSD: pmap.h,v 1.13 2008/05/03 00:21:35 ad Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
@ -161,6 +161,7 @@ struct pmap {
|
||||
#endif /* !defined(__x86_64__) */
|
||||
int pm_flags; /* see below */
|
||||
|
||||
bool pm_noflush; /* exec/exit in progress */
|
||||
union descriptor *pm_ldt; /* user-set LDT */
|
||||
int pm_ldt_len; /* number of LDT entries */
|
||||
int pm_ldt_sel; /* LDT selector */
|
||||
@ -224,6 +225,7 @@ bool pmap_test_attrs(struct vm_page *, unsigned);
|
||||
void pmap_write_protect(struct pmap *, vaddr_t, vaddr_t, vm_prot_t);
|
||||
void pmap_load(void);
|
||||
paddr_t pmap_init_tmp_pgtbl(paddr_t);
|
||||
void pmap_remove_all(struct pmap *);
|
||||
|
||||
vaddr_t reserve_dumppages(vaddr_t); /* XXX: not a pmap fn */
|
||||
|
||||
@ -242,13 +244,6 @@ bool pmap_pageidlezero(paddr_t);
|
||||
* inline functions
|
||||
*/
|
||||
|
||||
/*ARGSUSED*/
|
||||
static __inline void
|
||||
pmap_remove_all(struct pmap *pmap)
|
||||
{
|
||||
/* Nothing. */
|
||||
}
|
||||
|
||||
/*
|
||||
* pmap_update_pg: flush one page from the TLB (or flush the whole thing
|
||||
* if hardware doesn't support one-page flushing)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pmap.c,v 1.57 2008/05/02 15:26:39 ad Exp $ */
|
||||
/* $NetBSD: pmap.c,v 1.58 2008/05/03 00:21:35 ad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Manuel Bouyer.
|
||||
@ -154,7 +154,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.57 2008/05/02 15:26:39 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.58 2008/05/03 00:21:35 ad Exp $");
|
||||
|
||||
#include "opt_user_ldt.h"
|
||||
#include "opt_lockdebug.h"
|
||||
@ -2175,6 +2175,7 @@ pmap_create(void)
|
||||
pmap->pm_flags = 0;
|
||||
pmap->pm_cpus = 0;
|
||||
pmap->pm_kernel_cpus = 0;
|
||||
pmap->pm_noflush = false;
|
||||
|
||||
/* init the LDT */
|
||||
pmap->pm_ldt = NULL;
|
||||
@ -4431,6 +4432,20 @@ pmap_dump(struct pmap *pmap, vaddr_t sva, vaddr_t eva)
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* pmap_remove_all: pmap is being recycled or destroyed (exec or exit).
|
||||
*
|
||||
* => called by last LWP in process.
|
||||
*/
|
||||
|
||||
void
|
||||
pmap_remove_all(struct pmap *pm)
|
||||
{
|
||||
|
||||
/* Don't bother with flush activity until next pmap_update. */
|
||||
pm->pm_noflush = true;
|
||||
}
|
||||
|
||||
/*
|
||||
* pmap_tlb_shootdown: invalidate pages on all CPUs using pmap 'pm'
|
||||
*
|
||||
@ -4456,6 +4471,10 @@ pmap_tlb_shootdown(struct pmap *pm, vaddr_t sva, vaddr_t eva, pt_entry_t pte)
|
||||
|
||||
KASSERT(eva == 0 || eva >= sva);
|
||||
KASSERT(kpreempt_disabled());
|
||||
|
||||
if (pm->pm_noflush) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pte & PG_PS)
|
||||
sva &= PG_LGFRAME;
|
||||
@ -4635,6 +4654,11 @@ pmap_update(struct pmap *pm)
|
||||
kpreempt_disable();
|
||||
pmap_tlb_shootwait();
|
||||
kpreempt_enable();
|
||||
|
||||
if (pm->pm_noflush) {
|
||||
tlbflush();
|
||||
pm->pm_noflush = false;
|
||||
}
|
||||
}
|
||||
|
||||
#if PTP_LEVELS > 4
|
||||
|
Loading…
Reference in New Issue
Block a user