summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2000-05-27 20:14:19 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2000-05-27 20:14:19 +0000
commit1091e2eb8123535ca4f950a272a2fa7558764a4b (patch)
tree9af54a4b91ccb48227571dd68a50970e8ff5e7b2
parent35be7879f81cf9212ad3cdefc0496d369c1167ad (diff)
Make pmap_activate take struct proc * as arguemnt.
From NetBSD.
-rw-r--r--sys/arch/amiga/amiga/locore.s19
-rw-r--r--sys/arch/amiga/amiga/pmap.c37
-rw-r--r--sys/arch/amiga/include/pmap.h26
3 files changed, 49 insertions, 33 deletions
diff --git a/sys/arch/amiga/amiga/locore.s b/sys/arch/amiga/amiga/locore.s
index 619431899f2..fc578a22961 100644
--- a/sys/arch/amiga/amiga/locore.s
+++ b/sys/arch/amiga/amiga/locore.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.s,v 1.26 2000/05/27 19:48:36 art Exp $ */
+/* $OpenBSD: locore.s,v 1.27 2000/05/27 20:14:18 art Exp $ */
/* $NetBSD: locore.s,v 1.89 1997/07/17 16:22:54 is Exp $ */
/*
@@ -1228,7 +1228,7 @@ ENTRY(switch_exit)
movl a0@(P_ADDR),sp@- | address u-area of process
movl _kernel_map,sp@- | map it was allocated in
#if defined(UVM)
- jbsr _uvm_km_free ! deallocate it
+ jbsr _uvm_km_free | deallocate it
#else
jbsr _kmem_free | deallocate it
#endif
@@ -1379,18 +1379,17 @@ Lswnofpsave:
movb a1@(PCB_FLAGS+1),pcbflag | copy of pcb_flags low byte
/* see if pmap_activate needs to be called; should remove this */
- movl a0@(P_VMSPACE),a0 | vmspace = p->p_vmspace
+ movl a0@(P_VMSPACE),a2 | vmspace = p->p_vmspace
#ifdef DIAGNOSTIC
- tstl a0 | map == VM_MAP_NULL?
+ tstl a2 | map == VM_MAP_NULL?
jeq Lbadsw | panic
#endif
- movl a0@(VM_PMAP),a0 | pmap = vmspace->vm_map.pmap
- tstl a0@(PM_STCHG) | pmap->st_changed?
+ movl a2@(VM_PMAP),a2 | pmap = vmspace->vm_map.pmap
+ tstl a2@(PM_STCHG) | pmap->st_changed?
jeq Lswnochg | no, skip
- pea a1@ | push pcb (at p_addr)
- pea a0@ | push pmap
- jbsr _pmap_activate | pmap_activate(pmap, pcb)
- addql #8,sp
+ pea a0@ | push proc
+ jbsr _pmap_activate | pmap_activate(p)
+ addql #4,sp
movl _curpcb,a1 | restore p_addr
Lswnochg:
lea tmpstk,sp | now goto a tmp stack for NMI
diff --git a/sys/arch/amiga/amiga/pmap.c b/sys/arch/amiga/amiga/pmap.c
index 1bf8b1b74ea..45777618543 100644
--- a/sys/arch/amiga/amiga/pmap.c
+++ b/sys/arch/amiga/amiga/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.18 2000/05/27 19:42:49 art Exp $ */
+/* $OpenBSD: pmap.c,v 1.19 2000/05/27 20:14:18 art Exp $ */
/* $NetBSD: pmap.c,v 1.39 1997/06/10 18:26:41 veego Exp $ */
/*
@@ -258,7 +258,6 @@ boolean_t pmap_testbit __P((register vm_offset_t, int));
void pmap_enter_ptpage __P((register pmap_t, register vm_offset_t));
void pmap_collect1 __P((pmap_t, vm_offset_t, vm_offset_t));
-void pmap_activate __P((register pmap_t, struct pcb *));
extern vm_offset_t reserve_dumppages __P((vm_offset_t));
static void amiga_protection_init __P((void));
void pmap_check_wiring __P((char *, vm_offset_t));
@@ -1145,12 +1144,10 @@ pmap_remove(pmap, sva, eva)
* pointer for current process so
* update now to reload hardware.
*/
- if (curproc &&
- ptpmap ==
- curproc->p_vmspace->vm_map.pmap)
+ if (active_user_pmap(ptpmap))
PMAP_ACTIVATE(ptpmap,
(struct pcb *)
- curproc->p_addr, 1);
+ &curproc->p_addr->u_pcb, 1);
}
}
if (ptpmap == pmap_kernel())
@@ -1867,16 +1864,30 @@ ok:
}
}
+/*
+ * Mark that a processor is about to be used by a given pmap.
+ */
void
-pmap_activate(pmap, pcbp)
- register pmap_t pmap;
- struct pcb *pcbp;
+pmap_activate(p)
+ struct proc *p;
{
+ struct pcb *pcb = &p->p_addr->u_pcb;
+ pmap_t pmap = p->p_vmspace->vm_map.pmap;
+
#ifdef DEBUG
if (pmapdebug & (PDB_FOLLOW|PDB_SEGTAB))
- printf("pmap_activate(%p, %p)\n", pmap, pcbp);
+ printf("pmap_activate(%p)\n", p);
#endif
- PMAP_ACTIVATE(pmap, pcbp, pmap == curproc->p_vmspace->vm_map.pmap);
+ PMAP_ACTIVATE(pmap, pcbp, p == curproc);
+}
+
+/*
+ * Mark that a processor is no longer in use by a given pmap.
+ */
+void
+pmap_deactivate(p)
+ struct proc *p;
+{
}
/*
@@ -2267,8 +2278,8 @@ pmap_enter_ptpage(pmap, va)
* XXX may have changed segment table pointer for current
* process so update now to reload hardware.
*/
- if (pmap == curproc->p_vmspace->vm_map.pmap)
- PMAP_ACTIVATE(pmap, (struct pcb *)curproc->p_addr, 1);
+ if (active_user_pmap(pmap))
+ PMAP_ACTIVATE(pmap, &curproc->p_addr->u_pcb, 1);
#ifdef DEBUG
if (pmapdebug & (PDB_ENTER|PDB_PTPAGE|PDB_SEGTAB))
printf("enter_pt: pmap %p stab %p(%p)\n", pmap,
diff --git a/sys/arch/amiga/include/pmap.h b/sys/arch/amiga/include/pmap.h
index e318e9395a3..7ca76f2f778 100644
--- a/sys/arch/amiga/include/pmap.h
+++ b/sys/arch/amiga/include/pmap.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.h,v 1.4 2000/05/27 19:42:49 art Exp $ */
+/* $OpenBSD: pmap.h,v 1.5 2000/05/27 20:14:18 art Exp $ */
/* $NetBSD: pmap.h,v 1.17 1997/06/10 18:34:52 veego Exp $ */
/*
@@ -80,15 +80,13 @@ typedef struct pmap *pmap_t;
/*
* Macros for speed
*/
-#define PMAP_ACTIVATE(pmapp, pcbp, iscurproc) \
- if ((pmapp) != NULL && (pmapp)->pm_stchanged) { \
- (pcbp)->pcb_ustp = \
- m68k_btop((vm_offset_t)(pmapp)->pm_stpa); \
- if (iscurproc) \
- loadustp((pcbp)->pcb_ustp); \
- (pmapp)->pm_stchanged = FALSE; \
- }
-#define PMAP_DEACTIVATE(pmapp, pcbp)
+#define PMAP_ACTIVATE(pmap, pcb, loadhw) \
+{ \
+ (pcb)->pcb_ustp = m68k_btop((vm_offset_t)(pmap)->pm_stpa); \
+ if ((loadhw)) \
+ loadustp((pcb)->pcb_ustp); \
+ (pmap)->pm_stchanged = FALSE; \
+}
/*
* For each vm_page_t, there is a list of all currently valid virtual
@@ -134,8 +132,16 @@ struct pmap kernel_pmap_store;
#define pmap_kernel() (&kernel_pmap_store)
#define active_pmap(pm) \
((pm) == pmap_kernel() || (pm) == curproc->p_vmspace->vm_map.pmap)
+#define active_user_pmap(pm) \
+ (curproc && \
+ (pm) != pmap_kernel() && (pm) == curproc->p_vmspace->vm_map.pmap)
+
#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count)
#define pmap_wired_count(pmap) ((pmap)->pm_stats.wired_count)
+
+struct proc;
+void pmap_activate __P((struct proc *));
+void pmap_deactivate __P((struct proc *));
#endif /* _KERNEL */
#endif /* !_MACHINE_PMAP_H_ */