Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch A couple of tidy ups to pmap:
details: https://anonhg.NetBSD.org/src/rev/5bd194e82bdc
branches: trunk
changeset: 513341:5bd194e82bdc
user: chris <chris%NetBSD.org@localhost>
date: Sat Jul 28 18:12:43 2001 +0000
description:
A couple of tidy ups to pmap:
pmap_t -> struct pmap * in pmap.c and pmap.h
kernel_pmap -> pmap_kernel() everywhere.
Compiled and booted on riscpc and cats.
diffstat:
sys/arch/arm/arm32/arm32_machdep.c | 4 +-
sys/arch/arm/arm32/db_interface.c | 4 +-
sys/arch/arm/arm32/pmap.c | 101 +++++++++++++-------------
sys/arch/arm/footbridge/footbridge_io.c | 4 +-
sys/arch/arm/footbridge/footbridge_machdep.c | 4 +-
sys/arch/arm/include/arm32/pmap.h | 41 +++++++++-
sys/arch/arm/mainbus/mainbus_io.c | 4 +-
sys/arch/arm/sa11x0/sa11x0_io.c | 4 +-
sys/arch/arm32/iomd/iomd_dma.c | 4 +-
sys/arch/arm32/podulebus/esc.c | 6 +-
sys/arch/arm32/podulebus/podulebus.c | 6 +-
sys/arch/arm32/podulebus/sfas.c | 6 +-
sys/arch/arm32/riscpc/rpc_machdep.c | 6 +-
sys/arch/arm32/vidc/beep.c | 6 +-
sys/arch/arm32/vidc/console/vidcrender.c | 8 +-
sys/arch/arm32/vidc/lmcaudio.c | 4 +-
sys/arch/arm32/vidc/vidc20config.c | 8 +-
sys/arch/arm32/vidc/vidcaudio.c | 4 +-
sys/arch/hpcarm/hpcarm/hpc_machdep.c | 6 +-
sys/arch/hpcarm/hpcarm/machdep.c | 4 +-
sys/arch/hpcarm/sa11x0/sa11x0_io.c | 4 +-
21 files changed, 131 insertions(+), 107 deletions(-)
diffs (truncated from 865 to 300 lines):
diff -r 63f50f84bb1b -r 5bd194e82bdc sys/arch/arm/arm32/arm32_machdep.c
--- a/sys/arch/arm/arm32/arm32_machdep.c Sat Jul 28 17:18:59 2001 +0000
+++ b/sys/arch/arm/arm32/arm32_machdep.c Sat Jul 28 18:12:43 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: arm32_machdep.c,v 1.1 2001/07/28 13:28:03 chris Exp $ */
+/* $NetBSD: arm32_machdep.c,v 1.2 2001/07/28 18:12:43 chris Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
@@ -448,7 +448,7 @@
curpcb->pcb_flags = 0;
curpcb->pcb_und_sp = (u_int)proc0.p_addr + USPACE_UNDEF_STACK_TOP;
curpcb->pcb_sp = (u_int)proc0.p_addr + USPACE_SVC_STACK_TOP;
- (void) pmap_extract(kernel_pmap, (vaddr_t)(kernel_pmap)->pm_pdir,
+ (void) pmap_extract(pmap_kernel(), (vaddr_t)(pmap_kernel())->pm_pdir,
(paddr_t *)&curpcb->pcb_pagedir);
curpcb->pcb_tf = (struct trapframe *)curpcb->pcb_sp - 1;
diff -r 63f50f84bb1b -r 5bd194e82bdc sys/arch/arm/arm32/db_interface.c
--- a/sys/arch/arm/arm32/db_interface.c Sat Jul 28 17:18:59 2001 +0000
+++ b/sys/arch/arm/arm32/db_interface.c Sat Jul 28 18:12:43 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_interface.c,v 1.6 2001/06/24 07:32:20 chs Exp $ */
+/* $NetBSD: db_interface.c,v 1.7 2001/07/28 18:12:43 chris Exp $ */
/*
* Copyright (c) 1996 Scott K. Stevens
@@ -190,7 +190,7 @@
* otherwise use the kernel pmap's page directory.
*/
if (!p || !p->p_vmspace || !p->p_vmspace->vm_map.pmap)
- pdep = kernel_pmap->pm_pdir;
+ pdep = pmap_kernel()->pm_pdir;
else
pdep = p->p_vmspace->vm_map.pmap->pm_pdir;
diff -r 63f50f84bb1b -r 5bd194e82bdc sys/arch/arm/arm32/pmap.c
--- a/sys/arch/arm/arm32/pmap.c Sat Jul 28 17:18:59 2001 +0000
+++ b/sys/arch/arm/arm32/pmap.c Sat Jul 28 18:12:43 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.14 2001/07/08 19:44:43 chs Exp $ */
+/* $NetBSD: pmap.c,v 1.15 2001/07/28 18:12:43 chris Exp $ */
/*
* Copyright (c) 2001 Richard Earnshaw
@@ -151,7 +151,6 @@
#endif /* PMAP_DEBUG */
struct pmap kernel_pmap_store;
-pmap_t kernel_pmap;
/*
* pool that pmap structures are allocated from
@@ -192,7 +191,7 @@
#define ALLOC_PAGE_HOOK(x, s) \
x.va = virtual_start; \
- x.pte = (pt_entry_t *)pmap_pte(kernel_pmap, virtual_start); \
+ x.pte = (pt_entry_t *)pmap_pte(pmap_kernel(), virtual_start); \
virtual_start += s;
/* Variables used by the L1 page table queue code */
@@ -206,20 +205,20 @@
int l1pt_reuse_count; /* stat - L1's reused count */
/* Local function prototypes (not used outside this file) */
-pt_entry_t *pmap_pte __P((pmap_t pmap, vaddr_t va));
+pt_entry_t *pmap_pte __P((struct pmap *pmap, vaddr_t va));
void map_pagetable __P((vaddr_t pagetable, vaddr_t va,
paddr_t pa, unsigned int flags));
void pmap_copy_on_write __P((paddr_t pa));
-void pmap_pinit __P((pmap_t));
-void pmap_freepagedir __P((pmap_t));
-void pmap_release __P((pmap_t));
+void pmap_pinit __P((struct pmap *));
+void pmap_freepagedir __P((struct pmap *));
+void pmap_release __P((struct pmap *));
/* Other function prototypes */
extern void bzero_page __P((vaddr_t));
extern void bcopy_page __P((vaddr_t, vaddr_t));
struct l1pt *pmap_alloc_l1pt __P((void));
-static __inline void pmap_map_in_l1 __P((pmap_t pmap, vaddr_t va,
+static __inline void pmap_map_in_l1 __P((struct pmap *pmap, vaddr_t va,
vaddr_t l2pa));
static pt_entry_t *pmap_map_ptes __P((struct pmap *));
@@ -450,7 +449,7 @@
/*__inline*/ void
pmap_enter_pv(pmap, va, pv, flags)
- pmap_t pmap;
+ struct pmap *pmap;
vaddr_t va;
struct pv_entry *pv;
u_int flags;
@@ -514,7 +513,7 @@
/*__inline*/ void
pmap_remove_pv(pmap, va, pv)
- pmap_t pmap;
+ struct pmap *pmap;
vaddr_t va;
struct pv_entry *pv;
{
@@ -571,7 +570,7 @@
/*__inline */ u_int
pmap_modify_pv(pmap, va, pv, bic_mask, eor_mask)
- pmap_t pmap;
+ struct pmap *pmap;
vaddr_t va;
struct pv_entry *pv;
u_int bic_mask;
@@ -628,7 +627,7 @@
*/
static /*__inline*/ void
pmap_map_in_l1(pmap, va, l2pa)
- pmap_t pmap;
+ struct pmap *pmap;
vaddr_t va, l2pa;
{
vaddr_t ptva;
@@ -658,7 +657,7 @@
#if 0
static /*__inline*/ void
pmap_unmap_in_l1(pmap, va)
- pmap_t pmap;
+ struct pmap *pmap;
vaddr_t va;
{
vaddr_t ptva;
@@ -734,13 +733,11 @@
#endif
vsize_t size;
- kernel_pmap = &kernel_pmap_store;
-
- kernel_pmap->pm_pdir = kernel_l1pt;
- kernel_pmap->pm_pptpt = kernel_ptpt.pv_pa;
- kernel_pmap->pm_vptpt = kernel_ptpt.pv_va;
- simple_lock_init(&kernel_pmap->pm_lock);
- kernel_pmap->pm_count = 1;
+ pmap_kernel()->pm_pdir = kernel_l1pt;
+ pmap_kernel()->pm_pptpt = kernel_ptpt.pv_pa;
+ pmap_kernel()->pm_vptpt = kernel_ptpt.pv_va;
+ simple_lock_init(&pmap_kernel()->pm_lock);
+ pmap_kernel()->pm_count = 1;
/*
* Initialize PAGE_SIZE-dependent variables.
@@ -837,7 +834,7 @@
virtual_start += NBPG;
msgbufaddr = (caddr_t)virtual_start;
- msgbufpte = (pt_entry_t)pmap_pte(kernel_pmap, virtual_start);
+ msgbufpte = (pt_entry_t)pmap_pte(pmap_kernel(), virtual_start);
virtual_start += round_page(MSGBUFSIZE);
size = npages * sizeof(struct pv_entry);
@@ -966,7 +963,7 @@
pmap_t
pmap_create()
{
- pmap_t pmap;
+ struct pmap *pmap;
/*
* Fetch pmap entry from the pool
@@ -1067,7 +1064,7 @@
struct l1pt *pt;
{
/* Separate the physical memory for the virtual space */
- pmap_remove(kernel_pmap, pt->pt_va, pt->pt_va + PD_SIZE);
+ pmap_remove(pmap_kernel(), pt->pt_va, pt->pt_va + PD_SIZE);
pmap_update();
/* Return the physical memory */
@@ -1131,7 +1128,7 @@
if (!(pt->pt_flags & PTFLAG_KPT)) {
/* Duplicate the kernel mapping i.e. all mappings 0xf0000000+ */
- bcopy((char *)kernel_pmap->pm_pdir + (PD_SIZE - KERNEL_PD_SIZE),
+ bcopy((char *)pmap_kernel()->pm_pdir + (PD_SIZE - KERNEL_PD_SIZE),
(char *)pmap->pm_pdir + (PD_SIZE - KERNEL_PD_SIZE),
KERNEL_PD_SIZE);
pt->pt_flags |= PTFLAG_KPT;
@@ -1151,11 +1148,11 @@
return(ENOMEM);
}
- (void) pmap_extract(kernel_pmap, pmap->pm_vptpt, &pmap->pm_pptpt);
+ (void) pmap_extract(pmap_kernel(), pmap->pm_vptpt, &pmap->pm_pptpt);
pmap->pm_pptpt &= PG_FRAME;
/* Revoke cacheability and bufferability */
/* XXX should be done better than this */
- pte = pmap_pte(kernel_pmap, pmap->pm_vptpt);
+ pte = pmap_pte(pmap_kernel(), pmap->pm_vptpt);
*pte = *pte & ~(PT_C | PT_B);
/* Wire in this page table */
@@ -1224,7 +1221,7 @@
void
pmap_freepagedir(pmap)
- pmap_t pmap;
+ struct pmap *pmap;
{
/* Free the memory used for the page table mapping */
if (pmap->pm_vptpt != 0)
@@ -1255,7 +1252,7 @@
void
pmap_destroy(pmap)
- pmap_t pmap;
+ struct pmap *pmap;
{
int count;
@@ -1281,7 +1278,7 @@
void
pmap_release(pmap)
- pmap_t pmap;
+ struct pmap *pmap;
{
struct vm_page *page;
pt_entry_t *pte;
@@ -1321,14 +1318,14 @@
/*
- * void pmap_reference(pmap_t pmap)
+ * void pmap_reference(struct pmap *pmap)
*
* Add a reference to the specified pmap.
*/
void
pmap_reference(pmap)
- pmap_t pmap;
+ struct pmap *pmap;
{
if (pmap == NULL)
return;
@@ -1364,10 +1361,10 @@
pmap_activate(p)
struct proc *p;
{
- pmap_t pmap = p->p_vmspace->vm_map.pmap;
+ struct pmap *pmap = p->p_vmspace->vm_map.pmap;
struct pcb *pcb = &p->p_addr->u_pcb;
- (void) pmap_extract(kernel_pmap, (vaddr_t)pmap->pm_pdir,
+ (void) pmap_extract(pmap_kernel(), (vaddr_t)pmap->pm_pdir,
(paddr_t *)&pcb->pcb_pagedir);
PDEBUG(0, printf("pmap_activate: p=%p pmap=%p pcb=%p pdir=%p l1=%p\n",
@@ -1566,7 +1563,7 @@
#if 0
void
pmap_pte_addref(pmap, va)
- pmap_t pmap;
+ struct pmap *pmap;
vaddr_t va;
{
pd_entry_t *pde;
@@ -1588,7 +1585,7 @@
void
pmap_pte_delref(pmap, va)
- pmap_t pmap;
+ struct pmap *pmap;
vaddr_t va;
{
pd_entry_t *pde;
@@ -1748,7 +1745,7 @@
void
pmap_remove(pmap, sva, eva)
- pmap_t pmap;
+ struct pmap *pmap;
vaddr_t sva;
vaddr_t eva;
{
@@ -1782,7 +1779,7 @@
pte = &ptes[arm_byte_to_page(sva)];
/* Note if the pmap is active thus require cache and tlb cleans */
if ((curproc && curproc->p_vmspace->vm_map.pmap == pmap)
- || (pmap == kernel_pmap))
+ || (pmap == pmap_kernel()))
pmap_active = 1;
else
pmap_active = 0;
@@ -1900,7 +1897,7 @@
paddr_t pa;
{
struct pv_entry *ph, *pv, *npv;
- pmap_t pmap;
Home |
Main Index |
Thread Index |
Old Index