Implement pmap_activate().

This commit is contained in:
thorpej 1998-01-02 22:57:56 +00:00
parent a6f228e498
commit 9ca174a51d
2 changed files with 43 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.h,v 1.30 1997/08/04 20:00:47 pk Exp $ */
/* $NetBSD: pmap.h,v 1.31 1998/01/02 22:57:59 thorpej Exp $ */
/*
* Copyright (c) 1996
@ -239,14 +239,15 @@ int pmap_dumpmmu __P((int (*)__P((dev_t, daddr_t, caddr_t, size_t)),
#define pmap_resident_count(pmap) pmap_count_ptes(pmap)
#define managed(pa) ((unsigned)((pa) - vm_first_phys) < vm_num_phys)
#define PMAP_ACTIVATE(pmap, pcb, iscurproc)
#define PMAP_DEACTIVATE(pmap, pcb)
#define PMAP_PREFER(fo, ap) pmap_prefer((fo), (ap))
#define PMAP_EXCLUDE_DECLS /* tells MI pmap.h *not* to include decls */
/* FUNCTION DECLARATIONS FOR COMMON PMAP MODULE */
struct proc;
void pmap_activate __P((struct proc *));
void pmap_deactivate __P((struct proc *));
void pmap_bootstrap __P((int nmmu, int nctx, int nregion));
int pmap_count_ptes __P((struct pmap *));
void pmap_prefer __P((vm_offset_t, vm_offset_t *));

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.103 1997/11/19 23:19:13 pk Exp $ */
/* $NetBSD: pmap.c,v 1.104 1998/01/02 22:57:56 thorpej Exp $ */
/*
* Copyright (c) 1996
@ -6441,6 +6441,44 @@ pmap_redzone()
pmap_remove(pmap_kernel(), KERNBASE, KERNBASE+NBPG);
}
/*
* Activate the address space for the specified process. If the
* process is the current process, load the new MMU context.
*/
void
pmap_activate(p)
struct proc *p;
{
pmap_t pmap = p->p_vmspace->vm_map.pmap;
int s;
/*
* This is essentially the same thing that happens in cpu_switch()
* when the newly selected process is about to run, except that we
* have to make sure to clean the register windows before we set
* the new context.
*/
s = splpmap();
if (p == curproc) {
write_user_windows();
if (pmap->pm_ctx == NULL)
ctx_alloc(pmap); /* performs setcontext() */
else
setcontext(pmap->pm_ctxnum);
}
splx(s);
}
/*
* Deactivate the address space of the specified process.
*/
void
pmap_deactivate(p)
struct proc *p;
{
}
#ifdef DEBUG
/*
* Check consistency of a pmap (time consuming!).