From 9ca174a51dbb454bb10f71b3dc112a850a9f2623 Mon Sep 17 00:00:00 2001 From: thorpej Date: Fri, 2 Jan 1998 22:57:56 +0000 Subject: [PATCH] Implement pmap_activate(). --- sys/arch/sparc/include/pmap.h | 7 +++--- sys/arch/sparc/sparc/pmap.c | 40 ++++++++++++++++++++++++++++++++++- 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/sys/arch/sparc/include/pmap.h b/sys/arch/sparc/include/pmap.h index 042e12bf3b25..d14ef36ba286 100644 --- a/sys/arch/sparc/include/pmap.h +++ b/sys/arch/sparc/include/pmap.h @@ -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 *)); diff --git a/sys/arch/sparc/sparc/pmap.c b/sys/arch/sparc/sparc/pmap.c index b561a573396a..9f6b198b64e6 100644 --- a/sys/arch/sparc/sparc/pmap.c +++ b/sys/arch/sparc/sparc/pmap.c @@ -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!).