Change the pmap_extract() interface to:

boolean_t pmap_extract(pmap_t, vaddr_t, paddr_t *);
This makes it possible for the pmap to map physical address 0.
This commit is contained in:
thorpej 1999-07-08 18:05:21 +00:00
parent ea80527b05
commit 3ebbe095e0
92 changed files with 682 additions and 551 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.105 1999/06/26 03:15:54 thorpej Exp $ */
/* $NetBSD: pmap.c,v 1.106 1999/07/08 18:05:21 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@ -155,7 +155,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.105 1999/06/26 03:15:54 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.106 1999/07/08 18:05:21 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -2067,21 +2067,21 @@ pmap_unwire(pmap, va)
* Extract the physical address associated with the given
* pmap/virtual address pair.
*/
paddr_t
pmap_extract(pmap, va)
boolean_t
pmap_extract(pmap, va, pap)
pmap_t pmap;
vaddr_t va;
paddr_t *pap;
{
pt_entry_t *l1pte, *l2pte, *l3pte;
paddr_t pa;
int ps;
paddr_t pa;
boolean_t rv = FALSE;
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
printf("pmap_extract(%p, %lx) -> ", pmap, va);
#endif
pa = 0;
PMAP_LOCK(pmap, ps);
l1pte = pmap_l1pte(pmap, va);
@ -2097,14 +2097,21 @@ pmap_extract(pmap, va)
goto out;
pa = pmap_pte_pa(l3pte) | (va & PGOFSET);
if (pap != NULL)
*pap = pa;
rv = TRUE;
out:
PMAP_UNLOCK(pmap, ps);
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
printf("0x%lx\n", pa);
if (pmapdebug & PDB_FOLLOW) {
if (rv)
printf("0x%lx\n", pa);
else
printf("failed\n");
}
#endif
return (pa);
return (rv);
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.49 1999/05/26 22:07:36 thorpej Exp $ */
/* $NetBSD: vm_machdep.c,v 1.50 1999/07/08 18:05:22 thorpej Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@ -29,7 +29,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.49 1999/05/26 22:07:36 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.50 1999/07/08 18:05:22 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -371,8 +371,8 @@ vmapbuf(bp, len)
bp->b_data = (caddr_t)(taddr + off);
len = atop(len);
while (len--) {
pa = pmap_extract(vm_map_pmap(&p->p_vmspace->vm_map), faddr);
if (pa == 0)
if (pmap_extract(vm_map_pmap(&p->p_vmspace->vm_map), faddr,
&pa) == FALSE)
panic("vmapbuf: null page frame");
pmap_enter(vm_map_pmap(phys_map), taddr, trunc_page(pa),
VM_PROT_READ|VM_PROT_WRITE, TRUE, 0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: bus_dma.c,v 1.30 1999/05/25 23:14:03 thorpej Exp $ */
/* $NetBSD: bus_dma.c,v 1.31 1999/07/08 18:05:23 thorpej Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -41,7 +41,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.30 1999/05/25 23:14:03 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.31 1999/07/08 18:05:23 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -162,8 +162,8 @@ _bus_dmamap_load_buffer_direct_common(t, map, buf, buflen, p, flags,
* Get the physical address for this segment.
*/
if (p != NULL)
curaddr = pmap_extract(p->p_vmspace->vm_map.pmap,
vaddr);
(void) pmap_extract(p->p_vmspace->vm_map.pmap,
vaddr, &curaddr);
else
curaddr = vtophys(vaddr);

View File

@ -1,4 +1,4 @@
/* $NetBSD: sgmap_typedep.c,v 1.12 1998/08/14 16:50:02 thorpej Exp $ */
/* $NetBSD: sgmap_typedep.c,v 1.13 1999/07/08 18:05:23 thorpej Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
__KERNEL_RCSID(0, "$NetBSD: sgmap_typedep.c,v 1.12 1998/08/14 16:50:02 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: sgmap_typedep.c,v 1.13 1999/07/08 18:05:23 thorpej Exp $");
#include "opt_ddb.h"
@ -188,7 +188,8 @@ __C(SGMAP_TYPE,_load)(t, map, buf, buflen, p, flags, sgmap)
* Get the physical address for this segment.
*/
if (p != NULL)
pa = pmap_extract(p->p_vmspace->vm_map.pmap, va);
(void) pmap_extract(p->p_vmspace->vm_map.pmap, va,
&pa);
else
pa = vtophys(va);

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.68 1999/06/19 19:44:09 is Exp $ */
/* $NetBSD: pmap.c,v 1.69 1999/07/08 18:05:23 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -561,7 +561,7 @@ pmap_init()
if (addr == 0)
panic("pmap_init: can't allocate data structures");
Segtabzero = (u_int *) addr;
Segtabzeropa = (u_int *) pmap_extract(pmap_kernel(), addr);
(void) pmap_extract(pmap_kernel(), addr, (paddr_t *)&Segtabzero);
addr += AMIGA_STSIZE;
pv_table = (pv_entry_t) addr;
@ -637,7 +637,8 @@ pmap_init()
(--kpt_pages)->kpt_next = kpt_free_list;
kpt_free_list = kpt_pages;
kpt_pages->kpt_va = addr2;
kpt_pages->kpt_pa = pmap_extract(pmap_kernel(), addr2);
(void) pmap_extract(pmap_kernel(), addr2,
(paddr_t *)&kpt_pages->kpt_pa);
} while (addr != addr2);
#ifdef DEBUG
@ -1462,27 +1463,38 @@ pmap_unwire(pmap, va)
* with the given map/virtual_address pair.
*/
paddr_t
pmap_extract(pmap, va)
boolean_t
pmap_extract(pmap, va, pap)
pmap_t pmap;
vaddr_t va;
paddr_t *pap;
{
boolean_t rv = FALSE;
paddr_t pa;
u_int pte;
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
printf("pmap_extract(%p, %lx) -> ", pmap, va);
#endif
pa = 0;
if (pmap && pmap_ste_v(pmap, va))
pa = *(int *)pmap_pte(pmap, va);
if (pa)
pa = (pa & PG_FRAME) | (va & ~PG_FRAME);
if (pmap && pmap_ste_v(pmap, va)) {
pte = *(u_int *)pmap_pte(pmap, va);
if (pte) {
pa = (pte & PG_FRAME) | (va & ~PG_FRAME);
if (pap != NULL)
*pap = pa;
rv = TRUE;
}
}
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
printf("%lx\n", pa);
if (pmapdebug & PDB_FOLLOW) {
if (rv)
printf("%lx\n", pa);
else
printf("failed\n");
}
#endif
return(pa);
return (rv);
}
/*
@ -1635,7 +1647,7 @@ ok:
* We call pmap_remove to take care of invalidating ST
* and Sysptmap entries.
*/
kpa = pmap_extract(pmap, pv->pv_va);
(void) pmap_extract(pmap, pv->pv_va, (paddr_t *)&kpa);
pmap_remove_mapping(pmap, pv->pv_va, PT_ENTRY_NULL,
PRM_TFLUSH|PRM_CFLUSH);
/*
@ -2365,8 +2377,8 @@ pmap_enter_ptpage(pmap, va)
/* XXX Atari uses kernel_map here: */
pmap->pm_stab = (st_entry_t *)
uvm_km_zalloc(kernel_map, AMIGA_STSIZE);
pmap->pm_stpa = (u_int *) pmap_extract(
pmap_kernel(), (vaddr_t)pmap->pm_stab);
(void) pmap_extract(pmap_kernel(), (vaddr_t)pmap->pm_stab,
(paddr_t *)&pmap->pm_stpa);
#if defined(M68040) || defined(M68060)
if (mmutype == MMU_68040) {
#if defined(M68060)

View File

@ -1,4 +1,4 @@
/* $NetBSD: sys_machdep.c,v 1.22 1999/02/26 22:37:57 is Exp $ */
/* $NetBSD: sys_machdep.c,v 1.23 1999/07/08 18:05:23 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986 Regents of the University of California.
@ -153,9 +153,8 @@ cachectl1(req, addr, len, p)
*/
if (!doall &&
(pa == 0 || (addr & PGOFSET) == 0)) {
pa = pmap_extract(p->p_vmspace->vm_map.pmap,
addr);
if (pa == 0)
if (pmap_extract(p->p_vmspace->vm_map.pmap,
addr, &pa) == FALSE)
doall = 1;
}
switch (req) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.46 1999/05/26 22:19:33 thorpej Exp $ */
/* $NetBSD: vm_machdep.c,v 1.47 1999/07/08 18:05:23 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -167,24 +167,25 @@ pagemove(from, to, size)
register caddr_t from, to;
size_t size;
{
register vm_offset_t pa;
paddr_t pa;
boolean_t rv;
#ifdef DEBUG
if (size & CLOFSET)
panic("pagemove");
#endif
while (size > 0) {
pa = pmap_extract(pmap_kernel(), (vm_offset_t)from);
rv = pmap_extract(pmap_kernel(), (vaddr_t)from, &pa);
#ifdef DEBUG
if (pa == 0)
if (rv == FALSE)
panic("pagemove 2");
if (pmap_extract(pmap_kernel(), (vm_offset_t)to) != 0)
if (pmap_extract(pmap_kernel(), (vaddr_t)to, NULL) == TRUE)
panic("pagemove 3");
#endif
pmap_remove(pmap_kernel(),
(vm_offset_t)from, (vm_offset_t)from + PAGE_SIZE);
(vaddr_t)from, (vaddr_t)from + PAGE_SIZE);
pmap_enter(pmap_kernel(),
(vm_offset_t)to, pa, VM_PROT_READ|VM_PROT_WRITE, 1,
(vaddr_t)to, pa, VM_PROT_READ|VM_PROT_WRITE, 1,
VM_PROT_READ|VM_PROT_WRITE);
from += PAGE_SIZE;
to += PAGE_SIZE;
@ -333,12 +334,11 @@ int
kvtop(addr)
register caddr_t addr;
{
vm_offset_t va;
paddr_t pa;
va = pmap_extract(pmap_kernel(), (vm_offset_t)addr);
if (va == 0)
if (pmap_extract(pmap_kernel(), (vaddr_t)addr, &pa) == FALSE)
panic("kvtop: zero page frame");
return((int)va);
return (pa);
}
extern vm_map_t phys_map;
@ -371,8 +371,7 @@ vmapbuf(bp, len)
upmap = vm_map_pmap(&bp->b_proc->p_vmspace->vm_map);
kpmap = vm_map_pmap(phys_map);
do {
pa = pmap_extract(upmap, uva);
if (pa == 0)
if (pmap_extract(upmap, uva, &pa) == FALSE)
panic("vmapbuf: null page frame");
pmap_enter(kpmap, kva, pa, VM_PROT_READ|VM_PROT_WRITE, TRUE, 0);
uva += PAGE_SIZE;

View File

@ -1,4 +1,4 @@
/* $NetBSD: bus_dma.c,v 1.14 1999/05/25 23:14:04 thorpej Exp $ */
/* $NetBSD: bus_dma.c,v 1.15 1999/07/08 18:05:24 thorpej Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -646,7 +646,7 @@ _bus_dmamap_load_buffer(t, map, buf, buflen, p, flags, lastaddrp, segp, first)
/*
* Get the physical address for this segment.
*/
curaddr = pmap_extract(pmap, (vm_offset_t)vaddr);
(void) pmap_extract(pmap, (vaddr_t)vaddr, &curaddr);
/*
* Make sure we're in an allowed DMA range.

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.69 1999/05/26 19:16:29 thorpej Exp $ */
/* $NetBSD: machdep.c,v 1.70 1999/07/08 18:05:24 thorpej Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
@ -476,9 +476,9 @@ cpu_startup()
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;
curpcb->pcb_pagedir = (pd_entry_t *)pmap_extract(kernel_pmap,
(vm_offset_t)(kernel_pmap)->pm_pdir);
(void) pmap_extract(kernel_pmap, (vaddr_t)(kernel_pmap)->pm_pdir,
(paddr_t *)&curpcb->pcb_pagedir);
proc0.p_md.md_regs = (struct trapframe *)curpcb->pcb_sp - 1;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.62 1999/06/17 19:23:22 thorpej Exp $ */
/* $NetBSD: pmap.c,v 1.63 1999/07/08 18:05:24 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -1109,7 +1109,8 @@ pmap_allocpagedir(pmap)
}
#endif /* DIAGNOSTIC */
pmap->pm_vptpt = uvm_km_zalloc(kernel_map, NBPG);
pmap->pm_pptpt = pmap_extract(kernel_pmap, pmap->pm_vptpt) & PG_FRAME;
(void) pmap_extract(kernel_pmap, 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);
@ -1321,8 +1322,8 @@ pmap_activate(p)
pmap_t pmap = p->p_vmspace->vm_map.pmap;
struct pcb *pcb = &p->p_addr->u_pcb;
pcb->pcb_pagedir = (pd_entry_t *)pmap_extract(kernel_pmap,
(vm_offset_t)pmap->pm_pdir);
(void) pmap_extract(kernel_pmap, (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",
p, pmap, pcb, pmap->pm_pdir, pcb->pcb_pagedir));
@ -2369,13 +2370,14 @@ pmap_pte(pmap, va)
* Extract the physical page address associated
* with the given map/virtual_address pair.
*/
vm_offset_t
pmap_extract(pmap, va)
boolean_t
pmap_extract(pmap, va, pap)
pmap_t pmap;
vm_offset_t va;
vaddr_t va;
paddr_t *pap;
{
pt_entry_t *pte;
vm_offset_t pa;
paddr_t pa;
PDEBUG(5, printf("pmap_extract: pmap=%p, va=V%08lx\n", pmap, va));
@ -2386,11 +2388,11 @@ pmap_extract(pmap, va)
pte = pmap_pte(pmap, va);
if (!pte)
return(0);
return(FALSE);
/* Is the pte valid ? If not then no paged is actually mapped here */
if (!pmap_pte_v(pte))
return(0);
return(FALSE);
/* Return the physical address depending on the PTE type */
/* XXX What about L1 section mappings ? */
@ -2401,7 +2403,9 @@ pmap_extract(pmap, va)
PDEBUG(5, printf("pmap_extract: LPAGE pa = P%08lx\n",
(pa | (va & (L2_LPAGE_SIZE - 1)))));
return(pa | (va & (L2_LPAGE_SIZE - 1)));
if (pap != NULL)
*pap = pa | (va & (L2_LPAGE_SIZE - 1));
return (TRUE);
} else {
/* Extract the physical address from the pte */
pa = pmap_pte_pa(pte);
@ -2409,7 +2413,9 @@ pmap_extract(pmap, va)
PDEBUG(5, printf("pmap_extract: SPAGE pa = P%08lx\n",
(pa | (va & ~PG_FRAME))));
return(pa | (va & ~PG_FRAME));
if (pap != NULL)
*pap = pa | (va & ~PG_FRAME);
return (TRUE);
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: iomd_dma.c,v 1.3 1998/02/21 23:09:37 mark Exp $ */
/* $NetBSD: iomd_dma.c,v 1.4 1999/07/08 18:05:25 thorpej Exp $ */
/*
* Copyright (c) 1995 Scott Stevens
@ -194,13 +194,13 @@ dma_intr(dp)
/* return(0);*/
/* XXX */
#define PHYS(x) (pmap_extract(kernel_pmap, (vm_offset_t)x))
#define PHYS(x, y) pmap_extract(kernel_pmap, (vaddr_t)x, (paddr_t *)(y))
fill:
#ifdef DMA_DEBUG
printf("fill:\n");
#endif
if (dp->dc_len == 0) goto done;
cur = PHYS(dp->dc_nextaddr);
PHYS(dp->dc_nextaddr, &cur);
len = NBPG - (cur & PGOFSET);
if (len > dp->dc_len) {
/* Last buffer */

View File

@ -1,4 +1,4 @@
/* $NetBSD: esc.c,v 1.6 1999/03/24 05:50:57 mrg Exp $ */
/* $NetBSD: esc.c,v 1.7 1999/07/08 18:05:25 thorpej Exp $ */
/*
* Copyright (c) 1995 Scott Stevens
@ -201,7 +201,8 @@ escinitialize(dev)
* Setup bump buffer.
*/
dev->sc_bump_va = (u_char *)uvm_km_zalloc(kernel_map, dev->sc_bump_sz);
dev->sc_bump_pa = pmap_extract(kernel_pmap, (vm_offset_t)dev->sc_bump_va);
(void) pmap_extract(kernel_pmap, (vaddr_t)dev->sc_bump_va,
(paddr_t *)&dev->sc_bump_pa);
/*
* Setup pages to noncachable, that way we don't have to flush the cache

View File

@ -1,4 +1,4 @@
/* $NetBSD: sfas.c,v 1.13 1999/03/24 05:50:57 mrg Exp $ */
/* $NetBSD: sfas.c,v 1.14 1999/07/08 18:05:25 thorpej Exp $ */
/*
* Copyright (c) 1995 Scott Stevens
@ -202,7 +202,8 @@ sfasinitialize(dev)
* Setup bump buffer.
*/
dev->sc_bump_va = (u_char *)uvm_km_zalloc(kernel_map, dev->sc_bump_sz);
dev->sc_bump_pa = pmap_extract(kernel_pmap, (vm_offset_t)dev->sc_bump_va);
(void) pmap_extract(kernel_pmap, (vaddr_t)dev->sc_bump_va,
(paddr_t *)&dev->sc_bump_pa);
/*
* Setup pages to noncachable, that way we don't have to flush the cache

View File

@ -1,4 +1,4 @@
/* $NetBSD: rpc_machdep.c,v 1.29 1999/05/28 09:59:31 mark Exp $ */
/* $NetBSD: rpc_machdep.c,v 1.30 1999/07/08 18:05:25 thorpej Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
@ -1372,10 +1372,10 @@ void
rpc_sa110_cc_setup(void)
{
int loop;
vm_offset_t kaddr;
paddr_t kaddr;
pt_entry_t *pte;
kaddr = pmap_extract(kernel_pmap, KERNEL_TEXT_BASE);
(void) pmap_extract(kernel_pmap, KERNEL_TEXT_BASE, &kaddr);
for (loop = 0; loop < CPU_SA110_CACHE_CLEAN_SIZE; loop += NBPG) {
pte = pmap_pte(kernel_pmap, (sa110_cc_base + loop));
*pte = L2_PTE(kaddr, AP_KR);

View File

@ -1,4 +1,4 @@
/* $NetBSD: beep.c,v 1.16 1999/03/24 05:50:57 mrg Exp $ */
/* $NetBSD: beep.c,v 1.17 1999/07/08 18:05:25 thorpej Exp $ */
/*
* Copyright (c) 1995 Mark Brinicombe
@ -154,11 +154,11 @@ beepattach(parent, self, aux)
panic("beep: Cannot allocate page aligned buffer\n");
sc->sc_buffer1 = sc->sc_buffer0;
sc->sc_sound_cur0 = pmap_extract(kernel_pmap,
(vm_offset_t)sc->sc_buffer0 & PG_FRAME);
(void) pmap_extract(kernel_pmap, (vaddr_t)sc->sc_buffer0 & PG_FRAME,
(paddr_t *)&sc->sc_sound_cur0);
sc->sc_sound_end0 = (sc->sc_sound_cur0 + NBPG - 16) | 0x00000000;
sc->sc_sound_cur1 = pmap_extract(kernel_pmap,
(vm_offset_t)sc->sc_buffer1 & PG_FRAME);
(void) pmap_extract(kernel_pmap, (vaddr_t)sc->sc_buffer1 & PG_FRAME,
(paddr_t *)&sc->sc_sound_cur1);
sc->sc_sound_end1 = (sc->sc_sound_cur1 + NBPG - 16) | 0x00000000;
bcopy(beep_waveform, (void *)sc->sc_buffer0, sizeof(beep_waveform));

View File

@ -1,4 +1,4 @@
/* $NetBSD: vidcconsole.c,v 1.21 1999/03/24 05:50:57 mrg Exp $ */
/* $NetBSD: vidcconsole.c,v 1.22 1999/07/08 18:05:26 thorpej Exp $ */
/*
* Copyright (c) 1996 Mark Brinicombe
@ -1325,14 +1325,15 @@ vidc_cursor_init(vc)
static char *cursor_data = NULL;
int counter;
int line;
paddr_t pa;
if (!cursor_data) {
/* Allocate cursor memory first time round */
cursor_data = (char *)uvm_km_zalloc(kernel_map, NBPG);
if (!cursor_data)
panic("Cannot allocate memory for hardware cursor\n");
IOMD_WRITE_WORD(IOMD_CURSINIT, pmap_extract(kernel_pmap,
(vm_offset_t)cursor_data));
(void) pmap_extract(kernel_pmap, (vaddr_t)cursor_data, &pa);
IOMD_WRITE_WORD(IOMD_CURSINIT, pa);
}
/* Blank the cursor while initialising it's sprite */
@ -1365,8 +1366,10 @@ vidc_cursor_init(vc)
}
p_cursor_normal = pmap_extract(kernel_pmap,(vm_offset_t)cursor_normal );
p_cursor_transparent = pmap_extract(kernel_pmap,(vm_offset_t)cursor_transparent);
(void) pmap_extract(kernel_pmap, (vaddr_t)cursor_normal,
(paddr_t *)&p_cursor_normal);
(void) pmap_extract(kernel_pmap, (vaddr_t)cursor_transparent,
(paddr_t *)&p_cursor_transparent);
/*
memset ( cursor_normal, 0x55,

View File

@ -1,4 +1,4 @@
/* $NetBSD: lmcaudio.c,v 1.23 1999/03/24 05:50:57 mrg Exp $ */
/* $NetBSD: lmcaudio.c,v 1.24 1999/07/08 18:05:26 thorpej Exp $ */
/*
* Copyright (c) 1996, Danny C Tsen.
@ -531,7 +531,7 @@ lmcaudio_rate(rate)
return(0);
}
#define PHYS(x) (pmap_extract( kernel_pmap, ((x)&PG_FRAME) ))
#define PHYS(x, y) pmap_extract(kernel_pmap, ((x)&PG_FRAME), (paddr_t *)(y))
/*
* Program the next buffer to be used
@ -547,6 +547,7 @@ lmcaudio_dma_program(cur, end, intr, arg)
{
int size = end - cur;
u_int stopflag = 0;
paddr_t pa;
if (ag.drain) {
ag.drain++;
@ -559,10 +560,12 @@ lmcaudio_dma_program(cur, end, intr, arg)
IOMD_WRITE_WORD(IOMD_SD0CR, 0x90); /* Reset State Machine */
IOMD_WRITE_WORD(IOMD_SD0CR, 0x30); /* Reset State Machine */
IOMD_WRITE_WORD(IOMD_SD0CURA, PHYS(cur));
IOMD_WRITE_WORD(IOMD_SD0ENDA, (PHYS(cur) + size - 16)|stopflag);
IOMD_WRITE_WORD(IOMD_SD0CURB, PHYS(cur));
IOMD_WRITE_WORD(IOMD_SD0ENDB, (PHYS(cur) + size - 16)|stopflag);
PHYS(cur, &pa);
IOMD_WRITE_WORD(IOMD_SD0CURA, pa);
IOMD_WRITE_WORD(IOMD_SD0ENDA, (pa + size - 16)|stopflag);
IOMD_WRITE_WORD(IOMD_SD0CURB, pa);
IOMD_WRITE_WORD(IOMD_SD0ENDB, (pa + size - 16)|stopflag);
ag.in_progress = 1;
@ -590,7 +593,7 @@ lmcaudio_dma_program(cur, end, intr, arg)
} else {
/* We're OK to schedule it now */
ag.buffer = (++ag.buffer) & 1;
ag.next_cur = PHYS(cur);
PHYS(cur, &ag.next_cur);
ag.next_end = (ag.next_cur + size - 16) | stopflag;
ag.next_intr = intr;
ag.next_arg = arg;
@ -602,6 +605,8 @@ lmcaudio_dma_program(cur, end, intr, arg)
void
lmcaudio_shutdown()
{
paddr_t pa;
/* Shut down the channel */
ag.intr = NULL;
ag.in_progress = 0;
@ -611,8 +616,11 @@ lmcaudio_shutdown()
#endif
memset((char *)ag.silence, 0, NBPG);
IOMD_WRITE_WORD(IOMD_SD0CURA, PHYS(ag.silence));
IOMD_WRITE_WORD(IOMD_SD0ENDA, (PHYS(ag.silence) + NBPG - 16) | 0x80000000);
PHYS(ag.silence, &pa);
IOMD_WRITE_WORD(IOMD_SD0CURA, pa);
IOMD_WRITE_WORD(IOMD_SD0ENDA, (pa + NBPG - 16) | 0x80000000);
disable_irq(sdma_channel);
IOMD_WRITE_WORD(IOMD_SD0CR, 0x90); /* Reset State Machine */
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: vidcaudio.c,v 1.29 1999/03/24 05:50:57 mrg Exp $ */
/* $NetBSD: vidcaudio.c,v 1.30 1999/07/08 18:05:26 thorpej Exp $ */
/*
* Copyright (c) 1995 Melvin Tang-Richardson
@ -512,7 +512,7 @@ vidcaudio_stereo(channel, position)
return 0;
}
#define PHYS(x) (pmap_extract(kernel_pmap, ((x)&PG_FRAME)))
#define PHYS(x) pmap_extract(kernel_pmap, ((x)&PG_FRAME), (paddr_t *)(y))
/*
* Program the next buffer to be used
@ -528,16 +528,21 @@ vidcaudio_dma_program(cur, end, intr, arg)
void (*intr)();
void *arg;
{
paddr_t pa1, pa2;
/* If there isn't a transfer in progress then start a new one */
if (ag.in_progress == 0) {
ag.buffer = 0;
IOMD_WRITE_WORD(IOMD_SD0CR, 0x90); /* Reset State Machine */
IOMD_WRITE_WORD(IOMD_SD0CR, 0x30); /* Reset State Machine */
IOMD_WRITE_WORD(IOMD_SD0CURB, PHYS(cur));
IOMD_WRITE_WORD(IOMD_SD0ENDB, PHYS(end-16)|FLAGS);
IOMD_WRITE_WORD(IOMD_SD0CURA, PHYS(cur));
IOMD_WRITE_WORD(IOMD_SD0ENDA, PHYS(end-16)|FLAGS);
PHYS(cur, &pa1);
PHYS(end - 16, &pa2);
IOMD_WRITE_WORD(IOMD_SD0CURB, pa1);
IOMD_WRITE_WORD(IOMD_SD0ENDB, pa2|FLAGS);
IOMD_WRITE_WORD(IOMD_SD0CURA, pa1);
IOMD_WRITE_WORD(IOMD_SD0ENDA, pa2|FLAGS);
ag.in_progress = 1;
@ -573,8 +578,8 @@ vidcaudio_dma_program(cur, end, intr, arg)
} else {
/* We're OK to schedule it now */
ag.buffer = (++ag.buffer) & 1;
ag.next_cur = PHYS(cur);
ag.next_end = PHYS(end-16);
PHYS(cur, &ag.next_cur);
PHYS(end - 16, &ag.next_end);
ag.next_intr = intr;
ag.next_arg = arg;
#ifdef DEBUG

View File

@ -1,4 +1,4 @@
/* $NetBSD: bus.c,v 1.14 1999/05/25 23:14:04 thorpej Exp $ */
/* $NetBSD: bus.c,v 1.15 1999/07/08 18:05:26 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -613,7 +613,7 @@ _bus_dmamap_load_buffer(t, map, buf, buflen, p, flags, lastaddrp, segp, first)
/*
* Get the physical address for this segment.
*/
curaddr = pmap_extract(pmap, vaddr);
(void) pmap_extract(pmap, vaddr, &curaddr);
/*
* Compute the segment size, and adjust counts.

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.49 1999/06/18 07:13:16 leo Exp $ */
/* $NetBSD: pmap.c,v 1.50 1999/07/08 18:05:26 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -520,8 +520,7 @@ pmap_init()
if (addr == 0)
panic("pmap_init: can't allocate data structures");
Segtabzero = (u_int *) addr;
Segtabzeropa = (u_int *) pmap_extract(pmap_kernel(), addr);
(void) pmap_extract(pmap_kernel(), addr, (paddr_t *)&Segtabzeropa);
addr += ATARI_STSIZE;
pv_table = (pv_entry_t) addr;
addr += page_cnt * sizeof(struct pv_entry);
@ -596,7 +595,8 @@ pmap_init()
(--kpt_pages)->kpt_next = kpt_free_list;
kpt_free_list = kpt_pages;
kpt_pages->kpt_va = addr2;
kpt_pages->kpt_pa = pmap_extract(pmap_kernel(), addr2);
(void) pmap_extract(pmap_kernel(), addr2,
(paddr_t *)&kpt_pages->kpt_pa);
} while (addr != addr2);
#ifdef DEBUG
@ -1415,27 +1415,38 @@ pmap_unwire(pmap, va)
* with the given map/virtual_address pair.
*/
paddr_t
pmap_extract(pmap, va)
boolean_t
pmap_extract(pmap, va, pap)
register pmap_t pmap;
vaddr_t va;
paddr_t *pap;
{
register paddr_t pa;
boolean_t rv = FALSE;
paddr_t pa;
u_int pte;
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
printf("pmap_extract(%p, %lx) -> ", pmap, va);
#endif
pa = 0;
if (pmap && pmap_ste_v(pmap, va))
pa = *(int *)pmap_pte(pmap, va);
if (pa)
pa = (pa & PG_FRAME) | (va & ~PG_FRAME);
if (pmap && pmap_ste_v(pmap, va)) {
pte = *(u_int *)pmap_pte(pmap, va);
if (pte) {
pa = (pte & PG_FRAME) | (va & ~PG_FRAME);
if (pap != NULL)
*pap = pa;
rv = TRUE;
}
}
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
printf("%lx\n", pa);
if (pmapdebug & PDB_FOLLOW) {
if (rv)
printf("%lx\n", pa);
else
printf("failed\n");
}
#endif
return(pa);
return (rv);
}
/*
@ -1586,7 +1597,7 @@ ok:
* We call pmap_remove to take care of invalidating ST
* and Sysptmap entries.
*/
kpa = pmap_extract(pmap, pv->pv_va);
(void) pmap_extract(pmap, pv->pv_va, (paddr_t *)&kpa);
pmap_remove_mapping(pmap, pv->pv_va, PT_ENTRY_NULL,
PRM_TFLUSH|PRM_CFLUSH);
/*
@ -2313,8 +2324,8 @@ pmap_enter_ptpage(pmap, va)
if (pmap->pm_stab == Segtabzero) {
pmap->pm_stab = (u_int *)
uvm_km_zalloc(kernel_map, ATARI_STSIZE);
pmap->pm_stpa = (u_int *) pmap_extract(
pmap_kernel(), (vaddr_t)pmap->pm_stab);
(void) pmap_extract(pmap_kernel(),
(vaddr_t)pmap->pm_stab, (paddr_t *)&pmap->pm_stpa);
#if defined(M68040) || defined(M68060)
if (mmutype == MMU_68040) {
#if defined(M68060)

View File

@ -1,4 +1,4 @@
/* $NetBSD: sys_machdep.c,v 1.18 1999/02/26 22:37:57 is Exp $ */
/* $NetBSD: sys_machdep.c,v 1.19 1999/07/08 18:05:26 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986 Regents of the University of California.
@ -156,9 +156,8 @@ cachectl1(req, addr, len, p)
*/
if (!doall &&
(pa == 0 || (addr & PGOFSET) == 0)) {
pa = pmap_extract(p->p_vmspace->vm_map.pmap,
addr);
if (pa == 0)
if (pmap_extract(p->p_vmspace, addr, &pa) ==
FALSE)
doall = 1;
}
switch (req) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.43 1999/06/18 06:31:01 thorpej Exp $ */
/* $NetBSD: trap.c,v 1.44 1999/07/08 18:05:26 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -725,6 +725,7 @@ writeback(fp, docachepush)
int err = 0;
u_int fa = 0;
caddr_t oonfault = p->p_addr->u_pcb.pcb_onfault;
paddr_t pa;
#ifdef DEBUG
if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid)) {
@ -766,7 +767,8 @@ writeback(fp, docachepush)
VM_PROT_WRITE);
fa = (u_int)&vmmap[(f->f_fa & PGOFSET) & ~0xF];
bcopy((caddr_t)&f->f_pd0, (caddr_t)fa, 16);
DCFL(pmap_extract(pmap_kernel(), (vaddr_t)fa));
(void) pmap_extract(pmap_kernel(), (vaddr_t)fa, &pa);
DCFL(pa);
pmap_remove(pmap_kernel(), (vaddr_t)vmmap,
(vaddr_t)&vmmap[NBPG]);
} else
@ -988,8 +990,7 @@ dumpwb(num, s, a, d)
num, a, d, f7sz[(s & SSW4_SZMASK) >> 5],
f7tt[(s & SSW4_TTMASK) >> 3], f7tm[s & SSW4_TMMASK]);
printf(" PA ");
pa = pmap_extract(p->p_vmspace->vm_map.pmap, (vaddr_t)a);
if (pa == 0)
if (pmap_extract(p->p_vmspace->vm_map.pmap, (vaddr_t)a, &pa) == FALSE)
printf("<invalid address>");
else
printf("%lx, current value %lx", pa, fuword((caddr_t)a));

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.27 1999/05/26 22:19:35 thorpej Exp $ */
/* $NetBSD: vm_machdep.c,v 1.28 1999/07/08 18:05:26 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -168,18 +168,19 @@ pagemove(from, to, size)
register caddr_t from, to;
size_t size;
{
register paddr_t pa;
paddr_t pa;
boolean_t rv;
#ifdef DEBUG
if (size & CLOFSET)
panic("pagemove");
#endif
while (size > 0) {
pa = pmap_extract(pmap_kernel(), (vaddr_t)from);
rv = pmap_extract(pmap_kernel(), (vaddr_t)from, &pa);
#ifdef DEBUG
if (pa == 0)
if (rv == FALSE)
panic("pagemove 2");
if (pmap_extract(pmap_kernel(), (vaddr_t)to) != 0)
if (pmap_extract(pmap_kernel(), (vaddr_t)to, NULL) == TRUE)
panic("pagemove 3");
#endif
pmap_remove(pmap_kernel(),
@ -333,8 +334,7 @@ kvtop(addr)
{
paddr_t pa;
pa = pmap_extract(pmap_kernel(), (vaddr_t)addr);
if (pa == 0)
if (pmap_extract(pmap_kernel(), (vaddr_t)addr, &pa) == FALSE)
panic("kvtop: zero page frame");
return(pa);
}
@ -369,8 +369,7 @@ vmapbuf(bp, len)
upmap = vm_map_pmap(&bp->b_proc->p_vmspace->vm_map);
kpmap = vm_map_pmap(phys_map);
do {
pa = pmap_extract(upmap, uva);
if (pa == 0)
if (pmap_extract(upmap, uva, &pa) == FALSE)
panic("vmapbuf: null page frame");
pmap_enter(kpmap, kva, pa, VM_PROT_READ|VM_PROT_WRITE, TRUE, 0);
uva += PAGE_SIZE;

View File

@ -1,4 +1,4 @@
/* $NetBSD: bus_dma.c,v 1.23 1999/05/25 23:14:04 thorpej Exp $ */
/* $NetBSD: bus_dma.c,v 1.24 1999/07/08 18:05:27 thorpej Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -531,7 +531,7 @@ _bus_dmamap_load_buffer(t, map, buf, buflen, p, flags, lastaddrp, segp, first)
/*
* Get the physical address for this segment.
*/
curaddr = pmap_extract(pmap, vaddr);
(void) pmap_extract(pmap, vaddr, &curaddr);
/*
* If we're beyond the bounce threshold, notify

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.77 1999/06/17 19:23:23 thorpej Exp $ */
/* $NetBSD: pmap.c,v 1.78 1999/07/08 18:05:27 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -446,7 +446,7 @@ pmap_init()
panic("pmap_init: can't allocate data structures");
Segtabzero = (st_entry_t *) addr;
Segtabzeropa = (st_entry_t *) pmap_extract(pmap_kernel(), addr);
(void) pmap_extract(pmap_kernel(), addr, (paddr_t *)&Segtabzeropa);
addr += HP_STSIZE;
pv_table = (struct pv_entry *) addr;
@ -510,7 +510,8 @@ pmap_init()
(--kpt_pages)->kpt_next = kpt_free_list;
kpt_free_list = kpt_pages;
kpt_pages->kpt_va = addr2;
kpt_pages->kpt_pa = pmap_extract(pmap_kernel(), addr2);
(void) pmap_extract(pmap_kernel(), addr2,
(paddr_t *)&kpt_pages->kpt_pa);
} while (addr != addr2);
PMAP_DPRINTF(PDB_INIT, ("pmap_init: KPT: %ld pages from %lx to %lx\n",
@ -1498,25 +1499,38 @@ pmap_unwire(pmap, va)
* Extract the physical address associated with the given
* pmap/virtual address pair.
*/
paddr_t
pmap_extract(pmap, va)
boolean_t
pmap_extract(pmap, va, pap)
pmap_t pmap;
vaddr_t va;
paddr_t *pap;
{
boolean_t rv = FALSE;
paddr_t pa;
u_int pte;
PMAP_DPRINTF(PDB_FOLLOW,
("pmap_extract(%p, %lx) -> ", pmap, va));
pa = 0;
if (pmap && pmap_ste_v(pmap, va))
pa = *pmap_pte(pmap, va);
if (pa)
pa = (pa & PG_FRAME) | (va & ~PG_FRAME);
if (pmap && pmap_ste_v(pmap, va)) {
pte = *(u_int *)pmap_pte(pmap, va);
if (pte) {
pa = (pte & PG_FRAME) | (va & ~PG_FRAME);
if (pap != NULL)
*pap = pa;
rv = TRUE;
}
}
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW) {
if (rv)
printf("%lx\n", pa);
else
printf("failed\n");
}
#endif
PMAP_DPRINTF(PDB_FOLLOW, ("%lx\n", pa));
return (pa);
return (rv);
}
/*
@ -1674,7 +1688,7 @@ ok:
* We call pmap_remove_entry to take care of invalidating
* ST and Sysptmap entries.
*/
kpa = pmap_extract(pmap, pv->pv_va);
(void) pmap_extract(pmap, pv->pv_va, (paddr_t *)&kpa);
pmap_remove_mapping(pmap, pv->pv_va, PT_ENTRY_NULL,
PRM_TFLUSH|PRM_CFLUSH);
/*
@ -2430,8 +2444,8 @@ pmap_enter_ptpage(pmap, va)
if (pmap->pm_stab == Segtabzero) {
pmap->pm_stab = (st_entry_t *)
uvm_km_zalloc(st_map, HP_STSIZE);
pmap->pm_stpa = (st_entry_t *)
pmap_extract(pmap_kernel(), (vaddr_t)pmap->pm_stab);
(void) pmap_extract(pmap_kernel(), (vaddr_t)pmap->pm_stab,
(paddr_t *)&pmap->pm_stpa);
#if defined(M68040)
if (mmutype == MMU_68040) {
#ifdef DEBUG

View File

@ -1,4 +1,4 @@
/* $NetBSD: sys_machdep.c,v 1.25 1999/02/26 22:37:57 is Exp $ */
/* $NetBSD: sys_machdep.c,v 1.26 1999/07/08 18:05:27 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -178,9 +178,8 @@ cachectl1(req, addr, len, p)
*/
if (!doall &&
(pa == 0 || ((int)addr & PGOFSET) == 0)) {
pa = pmap_extract(p->p_vmspace->vm_map.pmap,
addr);
if (pa == 0)
if (pmap_extract(p->p_vmspace->vm_map.pmap,
addr, &pa) == FALSE)
doall = 1;
}
switch (req) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.71 1999/03/26 23:41:29 mycroft Exp $ */
/* $NetBSD: trap.c,v 1.72 1999/07/08 18:05:27 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -714,6 +714,7 @@ writeback(fp, docachepush)
int err = 0;
u_int fa;
caddr_t oonfault = p->p_addr->u_pcb.pcb_onfault;
paddr_t pa;
#ifdef DEBUG
if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid)) {
@ -755,7 +756,8 @@ writeback(fp, docachepush)
VM_PROT_WRITE);
fa = (u_int)&vmmap[(f->f_fa & PGOFSET) & ~0xF];
bcopy((caddr_t)&f->f_pd0, (caddr_t)fa, 16);
DCFL(pmap_extract(pmap_kernel(), (vaddr_t)fa));
(void) pmap_extract(pmap_kernel(), (vaddr_t)fa, &pa);
DCFL(pa);
pmap_remove(pmap_kernel(), (vaddr_t)vmmap,
(vaddr_t)&vmmap[NBPG]);
} else
@ -977,8 +979,7 @@ dumpwb(num, s, a, d)
num, a, d, f7sz[(s & SSW4_SZMASK) >> 5],
f7tt[(s & SSW4_TTMASK) >> 3], f7tm[s & SSW4_TMMASK]);
printf(" PA ");
pa = pmap_extract(p->p_vmspace->vm_map.pmap, (vaddr_t)a);
if (pa == 0)
if (pmap_extract(p->p_vmspace->vm_map.pmap, (vaddr_t)a, &pa) == FALSE)
printf("<invalid address>");
else
printf("%lx, current value %lx", pa, fuword((caddr_t)a));

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.50 1999/05/26 22:19:35 thorpej Exp $ */
/* $NetBSD: vm_machdep.c,v 1.51 1999/07/08 18:05:27 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -221,17 +221,18 @@ pagemove(from, to, size)
size_t size;
{
paddr_t pa;
boolean_t rv;
#ifdef DEBUG
if (size & CLOFSET)
panic("pagemove");
#endif
while (size > 0) {
pa = pmap_extract(pmap_kernel(), (vaddr_t)from);
rv = pmap_extract(pmap_kernel(), (vaddr_t)from, &pa);
#ifdef DEBUG
if (pa == 0)
if (rv == FALSE)
panic("pagemove 2");
if (pmap_extract(pmap_kernel(), (vaddr_t)to) != 0)
if (pmap_extract(pmap_kernel(), (vaddr_t)to, NULL) == TRUE)
panic("pagemove 3");
#endif
pmap_remove(pmap_kernel(),
@ -289,8 +290,7 @@ kvtop(addr)
{
paddr_t pa;
pa = pmap_extract(pmap_kernel(), (vaddr_t)addr);
if (pa == 0)
if (pmap_extract(pmap_kernel(), (vaddr_t)addr, &pa) == FALSE)
panic("kvtop: zero page frame");
return((int)pa);
}
@ -325,8 +325,7 @@ vmapbuf(bp, len)
upmap = vm_map_pmap(&bp->b_proc->p_vmspace->vm_map);
kpmap = vm_map_pmap(phys_map);
do {
pa = pmap_extract(upmap, uva);
if (pa == 0)
if (pmap_extract(upmap, uva, &pa) == FALSE)
panic("vmapbuf: null page frame");
pmap_enter(kpmap, kva, pa, VM_PROT_READ|VM_PROT_WRITE, TRUE, 0);
uva += PAGE_SIZE;

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.359 1999/06/17 00:12:11 thorpej Exp $ */
/* $NetBSD: machdep.c,v 1.360 1999/07/08 18:05:28 thorpej Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -2334,7 +2334,8 @@ i386_memio_unmap(t, bsh, size)
panic("i386_memio_unmap: overflow");
#endif
bpa = pmap_extract(pmap_kernel(), va) + (bsh & PGOFSET);
(void) pmap_extract(pmap_kernel(), va, &bpa);
bpa += (bsh & PGOFSET);
/*
* Free the kernel virtual mapping.
@ -2811,7 +2812,7 @@ _bus_dmamap_load_buffer(t, map, buf, buflen, p, flags, lastaddrp, segp, first)
/*
* Get the physical address for this segment.
*/
curaddr = pmap_extract(pmap, vaddr);
(void) pmap_extract(pmap, vaddr, &curaddr);
/*
* If we're beyond the bounce threshold, notify

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.72 1999/06/17 19:23:24 thorpej Exp $ */
/* $NetBSD: pmap.c,v 1.73 1999/07/08 18:05:28 thorpej Exp $ */
/*
*
@ -1791,8 +1791,8 @@ struct pmap *pmap;
pmap->pm_pdir = (pd_entry_t *) uvm_km_alloc(kernel_map, NBPG);
if (pmap->pm_pdir == NULL)
panic("pmap_pinit: kernel_map out of virtual space!");
pmap->pm_pdirpa = (u_int32_t)
pmap_extract(pmap_kernel(), (vaddr_t) pmap->pm_pdir);
(void) pmap_extract(pmap_kernel(), (vaddr_t) pmap->pm_pdir,
(paddr_t *) &pmap->pm_pdirpa);
/* init PDP */
/* zero init area */
@ -2052,15 +2052,13 @@ struct proc *p;
/*
* pmap_extract: extract a PA for the given VA
*
* => returns 0 if no mapping (thus preventing it from returning
* physical page 0!)
*/
paddr_t pmap_extract(pmap, va)
boolean_t pmap_extract(pmap, va, pap)
struct pmap *pmap;
vaddr_t va;
paddr_t *pap;
{
paddr_t retval;
@ -2070,9 +2068,11 @@ vaddr_t va;
ptes = pmap_map_ptes(pmap);
retval = (paddr_t) (ptes[i386_btop(va)] & PG_FRAME);
pmap_unmap_ptes(pmap);
return(retval | (va & ~PG_FRAME));
if (pap != NULL)
*pap = retval | (va & ~PG_FRAME);
return (TRUE);
}
return(0);
return (FALSE);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.81 1999/06/17 00:12:12 thorpej Exp $ */
/* $NetBSD: vm_machdep.c,v 1.82 1999/07/08 18:05:28 thorpej Exp $ */
/*-
* Copyright (c) 1995 Charles M. Hannum. All rights reserved.
@ -335,12 +335,11 @@ int
kvtop(addr)
register caddr_t addr;
{
vaddr_t va;
paddr_t pa;
va = pmap_extract(pmap_kernel(), (vaddr_t)addr);
if (va == 0)
if (pmap_extract(pmap_kernel(), (vaddr_t)addr, &pa) == FALSE)
panic("kvtop: zero page frame");
return((int)va);
return((int)pa);
}
extern vm_map_t phys_map;
@ -378,8 +377,8 @@ vmapbuf(bp, len)
* mapping is removed).
*/
while (len) {
fpa = pmap_extract(vm_map_pmap(&bp->b_proc->p_vmspace->vm_map),
faddr);
(void) pmap_extract(vm_map_pmap(&bp->b_proc->p_vmspace->vm_map),
faddr, &fpa);
pmap_enter(vm_map_pmap(phys_map), taddr, fpa,
VM_PROT_READ|VM_PROT_WRITE, TRUE, 0);
faddr += PAGE_SIZE;

View File

@ -1,4 +1,4 @@
/* $NetBSD: mappedcopy.c,v 1.5 1999/04/18 00:36:36 minoura Exp $ */
/* $NetBSD: mappedcopy.c,v 1.6 1999/07/08 18:05:28 thorpej Exp $ */
/*
* XXX This doesn't work yet. Soon. --thorpej@netbsd.org
@ -112,8 +112,7 @@ mappedcopyin(f, t, count)
/*
* Map in the page and bcopy data in from it
*/
upa = pmap_extract(upmap, trunc_page(fromp));
if (upa == 0)
if (pmap_extract(upmap, trunc_page(fromp), &upa) == FALSE)
panic("mappedcopyin: null page frame");
len = min(count, (PAGE_SIZE - off));
pmap_enter(pmap_kernel(), kva, upa,
@ -168,8 +167,7 @@ mappedcopyout(f, t, count)
/*
* Map in the page and bcopy data out to it
*/
upa = pmap_extract(upmap, trunc_page(top));
if (upa == 0)
if (pmap_extract(upmap, trunc_page(top), &upa) == FALSE)
panic("mappedcopyout: null page frame");
len = min(count, (PAGE_SIZE - off));
pmap_enter(pmap_kernel(), kva, upa,

View File

@ -1,4 +1,4 @@
/* $NetBSD: ite.c,v 1.50 1999/04/21 06:00:07 scottr Exp $ */
/* $NetBSD: ite.c,v 1.51 1999/07/08 18:05:29 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -939,7 +939,8 @@ itematch(parent, cf, aux)
if (strcmp(ga->ga_name, "ite"))
return 0;
pa = pmap_extract(pmap_kernel(), (vaddr_t)(gm->fbbase + gm->fboff));
(void) pmap_extract(pmap_kernel(),
(vaddr_t)(gm->fbbase + gm->fboff), &pa);
if (pa != mac68k_vidphys) {
if (pa < 0xf9000000 || pa > 0xfeffffff)

View File

@ -1,4 +1,4 @@
/* $NetBSD: bus_space.c,v 1.5 1999/03/26 23:41:30 mycroft Exp $ */
/* $NetBSD: bus_space.c,v 1.6 1999/07/08 18:05:29 thorpej Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -205,7 +205,8 @@ bus_space_unmap(t, bsh, size)
panic("bus_space_unmap: overflow");
#endif
bpa = pmap_extract(pmap_kernel(), va) + (bsh & PGOFSET);
(void) pmap_extract(pmap_kernel(), va, &bpa);
bpa += (bsh & PGOFSET);
/*
* Free the kernel virtual mapping.

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.60 1999/06/17 19:23:25 thorpej Exp $ */
/* $NetBSD: pmap.c,v 1.61 1999/07/08 18:05:29 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -439,7 +439,7 @@ pmap_init()
panic("pmap_init: can't allocate data structures");
Segtabzero = (st_entry_t *)addr;
Segtabzeropa = (st_entry_t *)pmap_extract(pmap_kernel(), addr);
(void) pmap_extract(pmap_kernel(), addr, (paddr_t *)&Segtabzeropa);
addr += MAC_STSIZE;
pv_table = (struct pv_entry *)addr;
@ -503,7 +503,8 @@ pmap_init()
(--kpt_pages)->kpt_next = kpt_free_list;
kpt_free_list = kpt_pages;
kpt_pages->kpt_va = addr2;
kpt_pages->kpt_pa = pmap_extract(pmap_kernel(), addr2);
(void) pmap_extract(pmap_kernel(), addr2,
(paddr_t *)&kpt_pages->kpt_pa);
} while (addr != addr2);
PMAP_DPRINTF(PDB_INIT, ("pmap_init: KPT: %ld pages from %lx to %lx\n",
@ -1371,24 +1372,36 @@ pmap_unwire(pmap, va)
* pmap/virtual address pair.
*/
paddr_t
pmap_extract(pmap, va)
pmap_extract(pmap, va, pap)
pmap_t pmap;
vaddr_t va;
paddr_t *pap;
{
boolean_t rv = FALSE;
paddr_t pa;
u_int pte;
PMAP_DPRINTF(PDB_FOLLOW,
("pmap_extract(%p, %lx) -> ", pmap, va));
pa = 0;
if (pmap && pmap_ste_v(pmap, va))
pa = *pmap_pte(pmap, va);
if (pa)
pa = (pa & PG_FRAME) | (va & ~PG_FRAME);
PMAP_DPRINTF(PDB_FOLLOW, ("%lx\n", pa));
return (pa);
if (pmap && pamp_ste_v(pmap, va)) {
pte = *(u_int *)pmap_pte(pmap, va);
if (pte) {
pa = (pte & PG_FRAME) | (va & ~PG_FRAME);
if (pap != NULL)
*pap = pa;
rv = TRUE;
}
}
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW) {
if (rv)
printf("%lx\n", pa);
else
printf("failed\n");
}
#endif
return (rv);
}
/*
@ -1546,7 +1559,7 @@ ok:
* We call pmap_remove_entry to take care of invalidating
* ST and Sysptmap entries.
*/
kpa = pmap_extract(pmap, pv->pv_va);
(void) pmap_extract(pmap, pv->pv_va, (paddr_t *)&kpa);
pmap_remove_mapping(pmap, pv->pv_va, PT_ENTRY_NULL,
PRM_TFLUSH|PRM_CFLUSH);
/*
@ -2170,8 +2183,8 @@ pmap_enter_ptpage(pmap, va)
if (pmap->pm_stab == Segtabzero) {
pmap->pm_stab = (st_entry_t *)
uvm_km_zalloc(st_map, MAC_STSIZE);
pmap->pm_stpa = (st_entry_t *)
pmap_extract(pmap_kernel(), (vaddr_t)pmap->pm_stab);
(void) pmap_extract(pmap_kernel(), (vaddr_t)pmap->pm_stab,
(paddr_t *)&pmap->pm_stpa);
#if defined(M68040)
if (mmutype == MMU_68040) {
#ifdef DEBUG

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.73 1999/04/06 05:55:06 scottr Exp $ */
/* $NetBSD: trap.c,v 1.74 1999/07/08 18:05:29 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -703,6 +703,7 @@ writeback(fp, docachepush)
int err = 0;
u_int fa;
caddr_t oonfault = p->p_addr->u_pcb.pcb_onfault;
paddr_t pa;
#ifdef DEBUG
if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid)) {
@ -744,7 +745,8 @@ writeback(fp, docachepush)
VM_PROT_WRITE);
fa = (u_int)&vmmap[(f->f_fa & PGOFSET) & ~0xF];
bcopy((caddr_t)&f->f_pd0, (caddr_t)fa, 16);
DCFL(pmap_extract(pmap_kernel(), (vaddr_t)fa));
(void) pmap_extract(pmap_kernel(), (vaddr_t)fa, &pa);
DCFL(pa);
pmap_remove(pmap_kernel(), (vaddr_t)vmmap,
(vaddr_t)&vmmap[NBPG]);
} else
@ -967,8 +969,7 @@ dumpwb(num, s, a, d)
num, a, d, f7sz[(s & SSW4_SZMASK) >> 5],
f7tt[(s & SSW4_TTMASK) >> 3], f7tm[s & SSW4_TMMASK]);
printf(" PA ");
pa = pmap_extract(p->p_vmspace->vm_map.pmap, (vaddr_t)a);
if (pa == 0)
if (pmap_extract(p->p_vmspace->vm_map.pmap, (vaddr_t)a, &pa) == FALSE)
printf("<invalid address>");
else
printf("%lx, current value %lx", pa, fuword((caddr_t)a));

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.40 1999/05/26 22:19:36 thorpej Exp $ */
/* $NetBSD: vm_machdep.c,v 1.41 1999/07/08 18:08:53 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -219,17 +219,18 @@ pagemove(from, to, size)
size_t size;
{
paddr_t pa;
boolean_t rv;
#ifdef DEBUG
if (size & CLOFSET)
panic("pagemove");
#endif
while (size > 0) {
pa = pmap_extract(pmap_kernel(), (vaddr_t)from);
rv = pmap_extract(pmap_kernel(), (vaddr_t)from, &pa);
#ifdef DEBUG
if (pa == 0)
if (rv == FALSE)
panic("pagemove 2");
if (pmap_extract(pmap_kernel(), (vaddr_t)to) != 0)
if (pmap_extract(pmap_kernel(), (vaddr_t)to, NULL) == TRUE)
panic("pagemove 3");
#endif
pmap_remove(pmap_kernel(),
@ -287,8 +288,7 @@ kvtop(addr)
{
paddr_t pa;
pa = pmap_extract(pmap_kernel(), (vaddr_t)addr);
if (pa == 0)
if (pmap_extract(pmap_kernel(), (vaddr_t)addr, &pa) == FALSE)
panic("kvtop: zero page frame");
return((int)pa);
}
@ -323,8 +323,7 @@ vmapbuf(bp, len)
upmap = vm_map_pmap(&bp->b_proc->p_vmspace->vm_map);
kpmap = vm_map_pmap(phys_map);
do {
pa = pmap_extract(upmap, uva);
if (pa == 0)
if (pmap_extract(umap, uva, &pa) == FALSE)
panic("vmapbuf: null page frame");
pmap_enter(kpmap, kva, pa, VM_PROT_READ|VM_PROT_WRITE, TRUE, 0);
uva += PAGE_SIZE;

View File

@ -1,4 +1,4 @@
/* $NetBSD: asc.c,v 1.32 1999/06/28 01:56:58 briggs Exp $ */
/* $NetBSD: asc.c,v 1.33 1999/07/08 18:08:54 thorpej Exp $ */
/*
* Copyright (C) 1997 Scott Reynolds
@ -296,7 +296,7 @@ ascmmap(dev, off, prot)
sc = asc_cd.cd_devs[unit];
if ((u_int)off < MAC68K_ASC_LEN) {
pa = pmap_extract(pmap_kernel(), (vaddr_t)sc->sc_handle);
(void) pmap_extract(pmap_kernel(), (vaddr_t)sc->sc_handle, &pa);
return m68k_btop(pa + off);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: bus_dma.c,v 1.9 1999/05/25 23:14:06 thorpej Exp $ */
/* $NetBSD: bus_dma.c,v 1.10 1999/07/08 18:08:55 thorpej Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -154,8 +154,8 @@ _bus_dmamap_load_buffer(t, map, buf, buflen, p, flags, lastaddrp, segp, first)
* Get the physical address for this segment.
*/
if (p != NULL)
curaddr = pmap_extract(p->p_vmspace->vm_map.pmap,
vaddr);
(void) pmap_extract(p->p_vmspace->vm_map.pmap,
vaddr, &curaddr);
else
curaddr = vtophys(vaddr);

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.49 1999/06/28 08:20:45 itojun Exp $ */
/* $NetBSD: machdep.c,v 1.50 1999/07/08 18:08:55 thorpej Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -602,6 +602,7 @@ setregs(p, pack, stack)
{
struct trapframe *tf = trapframe(p);
struct ps_strings arginfo;
paddr_t pa;
bzero(tf, sizeof *tf);
tf->fixreg[1] = -roundup(-stack + 8, 16);
@ -638,9 +639,10 @@ setregs(p, pack, stack)
p->p_addr->u_pcb.pcb_flags = 0;
/* sync I-cache for signal trampoline code */
__syncicache((void *)pmap_extract(p->p_addr->u_pcb.pcb_pm,
(vaddr_t)p->p_sigacts->ps_sigcode),
pack->ep_emul->e_esigcode - pack->ep_emul->e_sigcode);
(void) pmap_extract(p->p_addr->u_pcb.pcb_pm,
(vaddr_t)p->p_sigacts->ps_sigcode, &pa);
__syncicache((void *)pa,
pack->ep_emul->e_esigcode - pack->ep_emul->e_sigcode);
}
/*
@ -978,8 +980,7 @@ kvtop(addr)
va = trunc_page(addr);
off = (int)addr - va;
pa = pmap_extract(pmap_kernel(), va);
if (pa == 0) {
if (pmap_extract(pmap_kernel(), va, &pa) == FALSE) {
/*printf("kvtop: zero page frame (va=0x%x)\n", addr);*/
return (int)addr;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.68 1999/06/17 19:23:25 thorpej Exp $ */
/* $NetBSD: pmap.c,v 1.69 1999/07/08 18:08:55 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -78,7 +78,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.68 1999/06/17 19:23:25 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.69 1999/07/08 18:08:55 thorpej Exp $");
/*
* Manages physical address maps.
@ -1396,12 +1396,13 @@ pmap_unwire(pmap, va)
* Extract the physical page address associated
* with the given map/virtual_address pair.
*/
vaddr_t
pmap_extract(pmap, va)
boolean_t
pmap_extract(pmap, va, pap)
pmap_t pmap;
vaddr_t va;
paddr_t *pap;
{
vaddr_t pa;
paddr_t pa;
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
@ -1418,20 +1419,21 @@ pmap_extract(pmap, va)
pt_entry_t *pte;
if (!(pte = pmap_segmap(pmap, va)))
pa = 0;
return (FALSE);
else {
pte += (va >> PGSHIFT) & (NPTEPG - 1);
pa = pfn_to_vad(pte->pt_entry);
}
}
if (pa)
pa |= va & PGOFSET;
pa |= va & PGOFSET;
if (pap != NULL)
*pap = pa;
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
printf("pmap_extract: pa %lx\n", pa);
#endif
return (pa);
return (TRUE);
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.41 1999/05/28 22:59:40 thorpej Exp $ */
/* $NetBSD: vm_machdep.c,v 1.42 1999/07/08 18:08:55 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.41 1999/05/28 22:59:40 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.42 1999/07/08 18:08:55 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -322,8 +322,8 @@ vmapbuf(bp, len)
bp->b_data = (caddr_t)(taddr + off);
len = atop(len);
while (len--) {
pa = pmap_extract(vm_map_pmap(&p->p_vmspace->vm_map), faddr);
if (pa == 0)
if (pmap_extract(vm_map_pmap(&p->p_vmspace->vm_map), faddr,
&pa) == FALSE)
panic("vmapbuf: null page frame");
pmap_enter(vm_map_pmap(phys_map), taddr, trunc_page(pa),
VM_PROT_READ|VM_PROT_WRITE, TRUE, 0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ie.c,v 1.2 1999/02/14 17:54:28 scw Exp $ */
/* $NetBSD: if_ie.c,v 1.3 1999/07/08 18:08:55 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -236,8 +236,8 @@ ie_pcctwo_attach(parent, self, args)
sc->sc_reg = PCCTWO_VADDR(pa->pa_offset);
memset(ether_data_buff, 0, ether_data_buff_size);
sc->sc_iobase = (void *)pmap_extract(pmap_kernel(),
(vaddr_t)sc->sc_maddr);
(void) pmap_extract(pmap_kernel(), (vaddr_t)sc->sc_maddr,
(paddr_t *)&sc->sc_iobase);
sc->hwreset = ie_reset;
sc->hwinit = ie_hwinit;

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.36 1999/06/17 19:23:25 thorpej Exp $ */
/* $NetBSD: pmap.c,v 1.37 1999/07/08 18:08:56 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -425,7 +425,7 @@ pmap_init()
panic("pmap_init: can't allocate data structures");
Segtabzero = (st_entry_t *) addr;
Segtabzeropa = (st_entry_t *) pmap_extract(pmap_kernel(), addr);
(void) pmap_extract(pmap_kernel(), addr, (paddr_t *)&Segtabzeropa);
addr += HP_STSIZE;
pv_table = (struct pv_entry *) addr;
@ -489,7 +489,8 @@ pmap_init()
(--kpt_pages)->kpt_next = kpt_free_list;
kpt_free_list = kpt_pages;
kpt_pages->kpt_va = addr2;
kpt_pages->kpt_pa = pmap_extract(pmap_kernel(), addr2);
(void) pmap_extract(pmap_kernel(), addr2,
(paddr_t *)&kpt_pages->kpt_pa);
} while (addr != addr2);
PMAP_DPRINTF(PDB_INIT, ("pmap_init: KPT: %ld pages from %lx to %lx\n",
@ -1352,25 +1353,37 @@ pmap_unwire(pmap, va)
* Extract the physical address associated with the given
* pmap/virtual address pair.
*/
paddr_t
pmap_extract(pmap, va)
boolean_t
pmap_extract(pmap, va, pap)
pmap_t pmap;
vaddr_t va;
paddr_t *pap;
{
boolean_t rv = FALSE;
paddr_t pa;
u_int pte;
PMAP_DPRINTF(PDB_FOLLOW,
("pmap_extract(%p, %lx) -> ", pmap, va));
pa = 0;
if (pmap && pmap_ste_v(pmap, va))
pa = *pmap_pte(pmap, va);
if (pa)
pa = (pa & PG_FRAME) | (va & ~PG_FRAME);
PMAP_DPRINTF(PDB_FOLLOW, ("%lx\n", pa));
return (pa);
if (pmap && pmap_ste_v(pmap, va)) {
pte = *(u_int *)pmap_pte(pmap, va);
if (pte) {
pa = (pte & PG_FRAME) | (va & ~PG_FRAME);
if (pap != NULL)
*pap = pa;
rv = TRUE;
}
}
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW) {
if (rv)
printf("%lx\n", pa);
else
printf("failed\n");
}
#endif
return (rv);
}
/*
@ -1530,7 +1543,7 @@ ok:
* We call pmap_remove_entry to take care of invalidating
* ST and Sysptmap entries.
*/
kpa = pmap_extract(pmap, pv->pv_va);
(void) pmap_extract(pmap, pv->pv_va, (paddr_t *)&kpa);
pmap_remove_mapping(pmap, pv->pv_va, PT_ENTRY_NULL,
PRM_TFLUSH|PRM_CFLUSH);
/*
@ -2192,8 +2205,8 @@ pmap_enter_ptpage(pmap, va)
if (pmap->pm_stab == Segtabzero) {
pmap->pm_stab = (st_entry_t *)
uvm_km_zalloc(st_map, HP_STSIZE);
pmap->pm_stpa = (st_entry_t *)
pmap_extract(pmap_kernel(), (vaddr_t)pmap->pm_stab);
(void) pmap_extract(pmap_kernel(), (vaddr_t)pmap->pm_stab,
(paddr_t *)&pmap->pm_stpa);
#if defined(M68040)
if (mmutype == MMU_68040) {
#ifdef DEBUG

View File

@ -1,4 +1,4 @@
/* $NetBSD: sys_machdep.c,v 1.17 1999/02/26 22:37:58 is Exp $ */
/* $NetBSD: sys_machdep.c,v 1.18 1999/07/08 18:08:56 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -177,9 +177,8 @@ cachectl1(req, addr, len, p)
*/
if (!doall &&
(pa == 0 || ((int)addr & PGOFSET) == 0)) {
pa = pmap_extract(p->p_vmspace->vm_map.pmap,
addr);
if (pa == 0)
if (pmap_extract(p->p_vmspace->vm_map.pmap,
addr, &pa) == FALSE)
doall = 1;
}
switch (req) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.30 1999/03/26 23:41:32 mycroft Exp $ */
/* $NetBSD: trap.c,v 1.31 1999/07/08 18:08:56 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -711,6 +711,7 @@ writeback(fp, docachepush)
int err = 0;
u_int fa;
caddr_t oonfault = p->p_addr->u_pcb.pcb_onfault;
paddr_t pa;
#ifdef DEBUG
if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid)) {
@ -752,7 +753,8 @@ writeback(fp, docachepush)
VM_PROT_WRITE);
fa = (u_int)&vmmap[(f->f_fa & PGOFSET) & ~0xF];
bcopy((caddr_t)&f->f_pd0, (caddr_t)fa, 16);
DCFL(pmap_extract(pmap_kernel(), (vaddr_t)fa));
(void) pmap_extract(pmap_kernel(), (vaddr_t)fa, &pa);
DCFL(pa);
pmap_remove(pmap_kernel(), (vaddr_t)vmmap,
(vaddr_t)&vmmap[NBPG]);
} else
@ -974,8 +976,7 @@ dumpwb(num, s, a, d)
num, a, d, f7sz[(s & SSW4_SZMASK) >> 5],
f7tt[(s & SSW4_TTMASK) >> 3], f7tm[s & SSW4_TMMASK]);
printf(" PA ");
pa = pmap_extract(p->p_vmspace->vm_map.pmap, (vaddr_t)a);
if (pa == 0)
if (pmap_extract(p->p_vmspace->vm_map.pmap, (vaddr_t)a, &pa) == FALSE)
printf("<invalid address>");
else
printf("%lx, current value %lx", pa, fuword((caddr_t)a));

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.24 1999/05/26 22:19:36 thorpej Exp $ */
/* $NetBSD: vm_machdep.c,v 1.25 1999/07/08 18:08:56 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -229,17 +229,18 @@ pagemove(from, to, size)
size_t size;
{
paddr_t pa;
boolean_t rv;
#ifdef DEBUG
if (size & CLOFSET)
panic("pagemove");
#endif
while (size > 0) {
pa = pmap_extract(pmap_kernel(), (vaddr_t)from);
rv = pmap_extract(pmap_kernel(), (vaddr_t)from, &pa);
#ifdef DEBUG
if (pa == 0)
if (rv == FALSE)
panic("pagemove 2");
if (pmap_extract(pmap_kernel(), (vaddr_t)to) != 0)
if (pmap_extract(pmap_kernel(), (vaddr_t)to, NULL) == TRUE)
panic("pagemove 3");
#endif
pmap_remove(pmap_kernel(),
@ -355,12 +356,11 @@ setredzone(pte, vaddr)
kvtop(addr)
caddr_t addr;
{
vaddr_t va;
paddr_t pa;
va = pmap_extract(pmap_kernel(), (vaddr_t)addr);
if (va == 0)
if (pmap_extract(pmap_kernel(), (vaddr_t)addr, &pa) == FALSE)
panic("kvtop: zero page frame");
return((int)va);
return((int)pa);
}
extern vm_map_t phys_map;
@ -393,8 +393,7 @@ vmapbuf(bp, len)
upmap = vm_map_pmap(&bp->b_proc->p_vmspace->vm_map);
kpmap = vm_map_pmap(phys_map);
do {
pa = pmap_extract(upmap, uva);
if (pa == 0)
if (pmap_extract(upmap, uva, &pa) == FALSE)
panic("vmapbuf: null page frame");
pmap_enter(kpmap, kva, pa, VM_PROT_READ|VM_PROT_WRITE, TRUE, 0);
uva += PAGE_SIZE;

View File

@ -1,4 +1,4 @@
/* $NetBSD: bus_dma.c,v 1.8 1999/05/25 23:14:06 thorpej Exp $ */
/* $NetBSD: bus_dma.c,v 1.9 1999/07/08 18:08:56 thorpej Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -40,7 +40,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
#if 0
__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.8 1999/05/25 23:14:06 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.9 1999/07/08 18:08:56 thorpej Exp $");
#endif
#include <sys/param.h>
@ -188,10 +188,10 @@ _bus_dmamap_load_buffer_direct_common(map, buf, buflen, p, flags, wbase,
* Get the physical address for this segment.
*/
if (p != NULL)
curaddr = pmap_extract(p->p_vmspace->vm_map.pmap,
vaddr);
(void) pmap_extract(p->p_vmspace->vm_map.pmap,
vaddr, &curaddr);
else
curaddr = pmap_extract(pmap_kernel(),vaddr);
(void) pmap_extract(pmap_kernel(), vaddr, &curaddr);
curaddr |= wbase;

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.17 1999/06/17 19:23:26 thorpej Exp $ */
/* $NetBSD: pmap.c,v 1.18 1999/07/08 18:08:56 thorpej Exp $ */
/*
* This file was taken from mvme68k/mvme68k/pmap.c
@ -476,7 +476,7 @@ bogons:
panic("pmap_init: can't allocate data structures");
Segtabzero = (st_entry_t *) addr;
Segtabzeropa = (st_entry_t *) pmap_extract(pmap_kernel(), addr);
(void) pmap_extract(pmap_kernel(), addr, (paddr_t *)&Segtabzeropa);
addr += HP_STSIZE;
pv_table = (struct pv_entry *) addr;
@ -543,7 +543,8 @@ bogons:
(--kpt_pages)->kpt_next = kpt_free_list;
kpt_free_list = kpt_pages;
kpt_pages->kpt_va = addr2;
kpt_pages->kpt_pa = pmap_extract(pmap_kernel(), addr2);
(void) pmap_extract(pmap_kernel(), addr2,
(paddr_t *)&kpt_pages->kpt_pa);
} while (addr != addr2);
#ifdef PMAPSTATS
kpt_stats.kpttotal = atop(s);
@ -1600,27 +1601,39 @@ pmap_unwire(pmap, va)
* with the given map/virtual_address pair.
*/
paddr_t
pmap_extract(pmap, va)
boolean_t
pmap_extract(pmap, va, pap)
pmap_t pmap;
vaddr_t va;
paddr_t *pap;
{
boolean_t rv = FALSE;
paddr_t pa;
u_int pte;
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
printf("pmap_extract(%p, %lx) -> ", pmap, va);
#endif
pa = 0;
if (pmap && pmap_ste_v(pmap, va))
pa = *pmap_pte(pmap, va);
if (pa)
pa = (pa & PG_FRAME) | (va & ~PG_FRAME);
if (pmap && pmap_ste_v(pmap, va)) {
pte = *(u_int *)pmap_pte(pmap, va);
if (pte) {
pa = (pte & PG_FRAME) | (va & ~PG_FRAME);
if (pap != NULL)
*pap = pa;
rv = TRUE;
}
}
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
printf("%lx\n", pa);
if (pmapdebug & PDB_FOLLOW) {
if (rv)
printf("%lx\n", pa);
else
printf("failed\n");
}
#endif
return(pa);
return (rv);
}
/*
@ -1770,7 +1783,7 @@ ok:
* We call pmap_remove_entry to take care of invalidating
* ST and Sysptmap entries.
*/
kpa = pmap_extract(pmap, pv->pv_va);
(void) pmap_extract(pmap, pv->pv_va, (paddr_t *)&kpa);
pmap_remove_mapping(pmap, pv->pv_va, PT_ENTRY_NULL,
PRM_TFLUSH|PRM_CFLUSH);
/*
@ -2487,8 +2500,8 @@ pmap_enter_ptpage(pmap, va)
if (pmap->pm_stab == Segtabzero) {
pmap->pm_stab = (st_entry_t *)
uvm_km_zalloc(st_map, HP_STSIZE);
pmap->pm_stpa = (st_entry_t *)
pmap_extract(pmap_kernel(), (vaddr_t)pmap->pm_stab);
(void) pmap_extract(pmap_kernel(), (vaddr_t)pmap->pm_stab,
(paddr_t *)&pmap->pm_stpa);
#if defined(M68040)
if (mmutype == MMU_68040) {
#ifdef DEBUG

View File

@ -1,4 +1,4 @@
/* $NetBSD: sys_machdep.c,v 1.7 1999/02/26 22:37:58 is Exp $ */
/* $NetBSD: sys_machdep.c,v 1.8 1999/07/08 18:08:56 thorpej Exp $ */
/*
* This file was taken from mvme68k/mvme68k/sys_machdep.c
@ -151,7 +151,8 @@ cachectl1(req, addr, len, p)
#if defined(M68040)
if (mmutype == MMU_68040) {
int inc = 0;
int pa = 0, doall = 0;
int doall = 0;
paddr_t pa = 0;
vaddr_t end;
#ifdef COMPAT_HPUX
extern struct emul emul_hpux;
@ -183,9 +184,8 @@ cachectl1(req, addr, len, p)
*/
if (!doall &&
(pa == 0 || ((int)addr & PGOFSET) == 0)) {
pa = pmap_extract(p->p_vmspace->vm_map.pmap,
addr);
if (pa == 0)
if (pmap_extract(p->p_vmspace->vm_map.pmap,
addr, &pa) == FALSE)
doall = 1;
}
switch (req) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.14 1999/03/27 02:59:41 dbj Exp $ */
/* $NetBSD: trap.c,v 1.15 1999/07/08 18:08:57 thorpej Exp $ */
/*
* This file was taken from mvme68k/mvme68k/trap.c
@ -691,6 +691,7 @@ writeback(fp, docachepush)
int err = 0;
u_int fa;
caddr_t oonfault = p->p_addr->u_pcb.pcb_onfault;
paddr_t pa;
#ifdef DEBUG
if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid)) {
@ -732,7 +733,8 @@ writeback(fp, docachepush)
VM_PROT_WRITE);
fa = (u_int)&vmmap[(f->f_fa & PGOFSET) & ~0xF];
bcopy((caddr_t)&f->f_pd0, (caddr_t)fa, 16);
DCFL(pmap_extract(pmap_kernel(), (vaddr_t)fa));
(void) pmap_extract(pmap_kernel(), (vaddr_t)fa, &pa);
DCFL(pa);
pmap_remove(pmap_kernel(), (vaddr_t)vmmap,
(vaddr_t)&vmmap[NBPG]);
} else
@ -952,8 +954,7 @@ dumpwb(num, s, a, d)
num, a, d, f7sz[(s & SSW4_SZMASK) >> 5],
f7tt[(s & SSW4_TTMASK) >> 3], f7tm[s & SSW4_TMMASK]);
printf(" PA ");
pa = pmap_extract(p->p_vmspace->vm_map.pmap, (vaddr_t)a);
if (pa == 0)
if (pmap_extract(p->p_vmspace->vm_map.pmap, (vaddr_t)a, &pa) == FALSE)
printf("<invalid address>");
else
printf("%x, current value %x", pa, fuword((caddr_t)a));

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.12 1999/05/26 22:19:36 thorpej Exp $ */
/* $NetBSD: vm_machdep.c,v 1.13 1999/07/08 18:08:57 thorpej Exp $ */
/*
* This file was taken from mvme68k/mvme68k/vm_machdep.c
@ -240,17 +240,18 @@ pagemove(from, to, size)
size_t size;
{
paddr_t pa;
boolean_t rv;
#ifdef DEBUG
if (size & CLOFSET)
panic("pagemove");
#endif
while (size > 0) {
pa = pmap_extract(pmap_kernel(), (vaddr_t)from);
rv = pmap_extract(pmap_kernel(), (vaddr_t)from, &pa);
#ifdef DEBUG
if (pa == 0)
if (rv == FALSE)
panic("pagemove 2");
if (pmap_extract(pmap_kernel(), (vaddr_t)to) != 0)
if (pmap_extract(pmap_kernel(), (vaddr_t)to, NULL) == TRUE)
panic("pagemove 3");
#endif
pmap_remove(pmap_kernel(),
@ -366,12 +367,11 @@ setredzone(pte, vaddr)
kvtop(addr)
caddr_t addr;
{
vaddr_t va;
paddr_t pa;
va = pmap_extract(pmap_kernel(), (vaddr_t)addr);
if (va == 0)
if (pmap_extract(pmap_kernel(), (vaddr_t)addr, &pa) == FALSE)
panic("kvtop: zero page frame");
return((int)va);
return((int)pa);
}
extern vm_map_t phys_map;
@ -404,8 +404,7 @@ vmapbuf(bp, len)
upmap = vm_map_pmap(&bp->b_proc->p_vmspace->vm_map);
kpmap = vm_map_pmap(phys_map);
do {
pa = pmap_extract(upmap, uva);
if (pa == 0)
if (pmap_extract(upmap, uva, &pa) == FALSE)
panic("vmapbuf: null page frame");
pmap_enter(kpmap, kva, pa, VM_PROT_READ|VM_PROT_WRITE, TRUE, 0);
uva += PAGE_SIZE;

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.38 1999/06/26 09:09:52 matthias Exp $ */
/* $NetBSD: pmap.c,v 1.39 1999/07/08 18:08:57 thorpej Exp $ */
/*
*
@ -1699,8 +1699,8 @@ struct pmap *pmap;
pmap->pm_pdir = (pd_entry_t *) uvm_km_alloc(kernel_map, NBPG);
if (pmap->pm_pdir == NULL)
panic("pmap_pinit: kernel_map out of virtual space!");
pmap->pm_pdirpa = (u_int32_t)
pmap_extract(pmap_kernel(), (vaddr_t) pmap->pm_pdir);
(void) pmap_extract(pmap_kernel(), (vaddr_t) pmap->pm_pdir,
(paddr_t *) &pmap->pm_pdirpa);
/* init PDP */
/* zero init area */
@ -1871,15 +1871,13 @@ struct proc *p;
/*
* pmap_extract: extract a PA for the given VA
*
* => returns 0 if no mapping (thus preventing it from returning
* physical page 0!)
*/
paddr_t pmap_extract(pmap, va)
boolean_t pmap_extract(pmap, va, pap)
struct pmap *pmap;
vaddr_t va;
paddr_t *pap;
{
paddr_t retval;
@ -1889,9 +1887,11 @@ vaddr_t va;
ptes = pmap_map_ptes(pmap);
retval = (paddr_t) (ptes[ns532_btop(va)] & PG_FRAME);
pmap_unmap_ptes(pmap);
return(retval | (va & ~PG_FRAME));
if (pap != NULL)
*pap = retval | (va & ~PG_FRAME);
return (TRUE);
}
return(0);
return (FALSE);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.36 1999/06/26 09:09:52 matthias Exp $ */
/* $NetBSD: vm_machdep.c,v 1.37 1999/07/08 18:08:57 thorpej Exp $ */
/*-
* Copyright (c) 1996 Matthias Pfaller.
@ -328,12 +328,11 @@ int
kvtop(addr)
register caddr_t addr;
{
vaddr_t va;
paddr_t pa;
va = pmap_extract(pmap_kernel(), (vaddr_t)addr);
if (va == 0)
if (pmap_extract(pmap_kernel(), (vaddr_t)addr, &pa) == FALSE)
panic("kvtop: zero page frame");
return((int)va);
return((int)pa);
}
extern vm_map_t phys_map;
@ -371,8 +370,8 @@ vmapbuf(bp, len)
* mapping is removed).
*/
while (len) {
fpa = pmap_extract(vm_map_pmap(&bp->b_proc->p_vmspace->vm_map),
faddr);
(void) pmap_extract(vm_map_pmap(&bp->b_proc->p_vmspace->vm_map),
faddr, &fpa);
pmap_enter(vm_map_pmap(phys_map), taddr, fpa,
VM_PROT_READ|VM_PROT_WRITE, TRUE, 0);
faddr += PAGE_SIZE;

View File

@ -1,4 +1,4 @@
/* $NetBSD: bus_dma.c,v 1.14 1999/05/25 23:14:06 thorpej Exp $ */
/* $NetBSD: bus_dma.c,v 1.15 1999/07/08 18:08:57 thorpej Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -178,8 +178,8 @@ _bus_dmamap_load_buffer(map, buf, buflen, p, flags,
* Get the physical address for this segment.
*/
if (p != NULL)
curaddr = pmap_extract(p->p_vmspace->vm_map.pmap,
vaddr);
(void) pmap_extract(p->p_vmspace->vm_map.pmap,
vaddr, &curaddr);
else
curaddr = kvtophys(vaddr);

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.h,v 1.13 1999/06/17 19:23:21 thorpej Exp $ */
/* $NetBSD: pmap.h,v 1.14 1999/07/08 18:08:58 thorpej Exp $ */
/*-
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -74,7 +74,7 @@ extern struct pmap kernel_pmap_;
#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count)
void pmap_bootstrap __P((u_int kernelstart, u_int kernelend));
paddr_t pmap_extract __P((struct pmap *, vaddr_t));
boolean_t pmap_extract __P((struct pmap *, vaddr_t, paddr_t *));
void ptemodify __P((paddr_t, u_int, u_int));
int ptebits __P((paddr_t, int));

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.22 1999/06/17 18:21:34 thorpej Exp $ */
/* $NetBSD: pmap.c,v 1.23 1999/07/08 18:08:58 thorpej Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -1106,22 +1106,22 @@ pte_find(pm, va)
/*
* Get the physical page address for the given pmap/virtual address.
*/
paddr_t
pmap_extract(pm, va)
boolean_t
pmap_extract(pm, va, pap)
struct pmap *pm;
vaddr_t va;
paddr_t *pap;
{
pte_t *ptp;
paddr_t o;
int s = splimp();
if (!(ptp = pte_find(pm, va))) {
splx(s);
return 0;
return (FALSE);
}
o = (ptp->pte_lo & PTE_RPGN) | (va & ADDR_POFF);
*pap = (ptp->pte_lo & PTE_RPGN) | (va & ADDR_POFF);
splx(s);
return o;
return (TRUE);
}
/*
@ -1362,8 +1362,8 @@ pmap_activate(p)
*/
if (pcb->pcb_pm != pmap) {
pcb->pcb_pm = pmap;
pcb->pcb_pmreal = (struct pmap *)pmap_extract(pmap_kernel(),
(vaddr_t)pcb->pcb_pm);
(void) pmap_extract(pmap_kernel(), (vaddr_t)pcb->pcb_pm,
(paddr_t *)&pcb->pcb_pmreal);
}
if (p == curproc) {
@ -1418,6 +1418,6 @@ pmap_procwr(p, va, len)
{
paddr_t pa;
pa = pmap_extract(p->p_vmspace->vm_map.pmap, va);
(void) pmap_extract(p->p_vmspace->vm_map.pmap, va, &pa);
__syncicache((void *)pa, len);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.12 1999/05/26 22:19:38 thorpej Exp $ */
/* $NetBSD: vm_machdep.c,v 1.13 1999/07/08 18:08:58 thorpej Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -76,8 +76,9 @@ cpu_fork(p1, p2, stack, stacksize)
*pcb = p1->p_addr->u_pcb;
pcb->pcb_pm = p2->p_vmspace->vm_map.pmap;
pcb->pcb_pmreal = (struct pmap *)pmap_extract(pmap_kernel(), (vaddr_t)pcb->pcb_pm);
(void) pmap_extract(pmap_kernel(), (vaddr_t)pcb->pcb_pm,
(paddr_t *)&pcb->pcb_pmreal);
/*
* Setup the trap frame for the new process
*/
@ -142,7 +143,8 @@ cpu_swapin(p)
{
struct pcb *pcb = &p->p_addr->u_pcb;
pcb->pcb_pmreal = (struct pmap *)pmap_extract(pmap_kernel(), (vaddr_t)pcb->pcb_pm);
(void) pmap_extract(pmap_kernel(), (vaddr_t)pcb->pcb_pm,
(paddr_t *)&pcb->pcb_pmreal);
}
/*
@ -157,7 +159,7 @@ pagemove(from, to, size)
vaddr_t va;
for (va = (vaddr_t)from; size > 0; size -= NBPG) {
pa = pmap_extract(pmap_kernel(), va);
(void) pmap_extract(pmap_kernel(), va, &pa);
pmap_remove(pmap_kernel(), va, va + NBPG);
pmap_enter(pmap_kernel(), (vaddr_t)to, pa,
VM_PROT_READ|VM_PROT_WRITE, 1, VM_PROT_READ|VM_PROT_WRITE);
@ -248,7 +250,8 @@ vmapbuf(bp, len)
taddr = uvm_km_valloc_wait(phys_map, len);
bp->b_data = (caddr_t)(taddr + off);
for (; len > 0; len -= NBPG) {
pa = pmap_extract(vm_map_pmap(&bp->b_proc->p_vmspace->vm_map), faddr);
(void) pmap_extract(vm_map_pmap(&bp->b_proc->p_vmspace->vm_map),
faddr, &pa);
pmap_enter(vm_map_pmap(phys_map), taddr, pa,
VM_PROT_READ|VM_PROT_WRITE, 1, 0);
faddr += NBPG;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ie_obio.c,v 1.10 1999/03/26 23:41:34 mycroft Exp $ */
/* $NetBSD: if_ie_obio.c,v 1.11 1999/07/08 18:08:58 thorpej Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -369,8 +369,7 @@ extern void myetheraddr(u_char *); /* should be elsewhere */
*/
/* Double map the SCP */
pa = pmap_extract(pmap_kernel(), (vaddr_t)sc->sc_maddr);
if (pa == 0)
if (pmap_extract(pmap_kernel(), (vaddr_t)sc->sc_maddr, &pa) == FALSE)
panic("ie pmap_extract");
pmap_enter(pmap_kernel(), trunc_page(IEOB_ADBASE+IE_SCP_ADDR),

View File

@ -1,4 +1,4 @@
/* $NetBSD: vme_machdep.c,v 1.19 1999/06/30 15:18:58 drochner Exp $ */
/* $NetBSD: vme_machdep.c,v 1.20 1999/07/08 18:08:58 thorpej Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -863,7 +863,7 @@ sparc_vme4_dmamap_load(t, map, buf, buflen, p, flags)
/*
* Get the physical address for this page.
*/
pa = pmap_extract(pmap, vaddr);
(void) pmap_extract(pmap, vaddr, &pa);
/*
* Compute the segment size, and adjust counts.

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.h,v 1.39 1999/06/28 14:44:57 pk Exp $ */
/* $NetBSD: pmap.h,v 1.40 1999/07/08 18:08:58 thorpej Exp $ */
/*
* Copyright (c) 1996
@ -281,7 +281,7 @@ void pmap_clear_reference4_4c __P((paddr_t pa));
void pmap_copy_page4_4c __P((paddr_t, paddr_t));
void pmap_enter4_4c __P((pmap_t, vaddr_t, paddr_t, vm_prot_t,
boolean_t, vm_prot_t));
paddr_t pmap_extract4_4c __P((pmap_t, vaddr_t));
boolean_t pmap_extract4_4c __P((pmap_t, vaddr_t, paddr_t *));
boolean_t pmap_is_modified4_4c __P((paddr_t pa));
boolean_t pmap_is_referenced4_4c __P((paddr_t pa));
void pmap_page_protect4_4c __P((paddr_t, vm_prot_t));
@ -299,7 +299,7 @@ void pmap_clear_reference4m __P((paddr_t pa));
void pmap_copy_page4m __P((paddr_t, paddr_t));
void pmap_enter4m __P((pmap_t, vaddr_t, paddr_t, vm_prot_t,
boolean_t, vm_prot_t));
paddr_t pmap_extract4m __P((pmap_t, vaddr_t));
boolean_t pmap_extract4m __P((pmap_t, vaddr_t, paddr_t *));
boolean_t pmap_is_modified4m __P((paddr_t pa));
boolean_t pmap_is_referenced4m __P((paddr_t pa));
void pmap_page_protect4m __P((paddr_t, vm_prot_t));
@ -344,7 +344,7 @@ extern void (*pmap_clear_reference_p) __P((paddr_t pa));
extern void (*pmap_copy_page_p) __P((paddr_t, paddr_t));
extern void (*pmap_enter_p) __P((pmap_t, vaddr_t, paddr_t, vm_prot_t,
boolean_t, vm_prot_t));
extern paddr_t (*pmap_extract_p) __P((pmap_t, vaddr_t));
extern boolean_t (*pmap_extract_p) __P((pmap_t, vaddr_t, paddr_t *));
extern boolean_t(*pmap_is_modified_p) __P((paddr_t pa));
extern boolean_t(*pmap_is_referenced_p) __P((paddr_t pa));
extern void (*pmap_page_protect_p) __P((paddr_t, vm_prot_t));

View File

@ -1,4 +1,4 @@
/* $NetBSD: iommu.c,v 1.34 1999/05/25 23:14:07 thorpej Exp $ */
/* $NetBSD: iommu.c,v 1.35 1999/07/08 18:08:58 thorpej Exp $ */
/*
* Copyright (c) 1996
@ -412,7 +412,8 @@ iommu_alloc(va, len)
u_int va, len;
{
struct iommu_softc *sc = X;
int off, tva, pa, iovaddr, pte;
int off, tva, iovaddr, pte;
paddr_t pa;
off = (int)va & PGOFSET;
len = round_page(len + off);
@ -424,7 +425,7 @@ if ((int)sc->sc_dvmacur + len > 0)
iovaddr = tva = sc->sc_dvmacur;
sc->sc_dvmacur += len;
while (len) {
pa = pmap_extract(pmap_kernel(), va);
(void) pmap_extract(pmap_kernel(), va, &pa);
#define IOMMU_PPNSHIFT 8
#define IOMMU_V 0x00000002
@ -506,10 +507,11 @@ iommu_dmamap_load(t, map, buf, buflen, p, flags)
pmap = pmap_kernel();
for (; sgsize != 0; ) {
paddr_t pa;
/*
* Get the physical address for this page.
*/
paddr_t pa = pmap_extract(pmap, va);
(void) pmap_extract(pmap, va, &pa);
iommu_enter(dva, pa);

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.151 1999/05/26 19:16:34 thorpej Exp $ */
/* $NetBSD: machdep.c,v 1.152 1999/07/08 18:08:59 thorpej Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -1339,10 +1339,11 @@ sun4_dmamap_load(t, map, buf, buflen, p, flags)
pmap = pmap_kernel();
for (; buflen > 0; ) {
paddr_t pa;
/*
* Get the physical address for this page.
*/
paddr_t pa = (bus_addr_t)pmap_extract(pmap, (vaddr_t)vaddr);
(void) pmap_extract(pmap, (vaddr_t)vaddr, &pa);
/*
* Compute the segment size, and adjust counts.

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.148 1999/06/28 14:41:43 pk Exp $ */
/* $NetBSD: pmap.c,v 1.149 1999/07/08 18:08:59 thorpej Exp $ */
/*
* Copyright (c) 1996
@ -496,7 +496,7 @@ void (*pmap_clear_reference_p) __P((paddr_t pa));
void (*pmap_copy_page_p) __P((paddr_t, paddr_t));
void (*pmap_enter_p) __P((pmap_t, vaddr_t, paddr_t, vm_prot_t,
boolean_t, vm_prot_t));
paddr_t (*pmap_extract_p) __P((pmap_t, vaddr_t));
boolean_t (*pmap_extract_p) __P((pmap_t, vaddr_t, paddr_t *));
boolean_t (*pmap_is_modified_p) __P((paddr_t pa));
boolean_t (*pmap_is_referenced_p) __P((paddr_t pa));
void (*pmap_page_protect_p) __P((paddr_t, vm_prot_t));
@ -5980,10 +5980,11 @@ pmap_unwire(pm, va)
*/
#if defined(SUN4) || defined(SUN4C)
paddr_t
pmap_extract4_4c(pm, va)
boolean_t
pmap_extract4_4c(pm, va, pap)
struct pmap *pm;
vaddr_t va;
paddr_t *pap;
{
int tpte;
int vr, vs;
@ -5995,7 +5996,7 @@ pmap_extract4_4c(pm, va)
if (pmapdebug & PDB_FOLLOW)
printf("pmap_extract: null pmap\n");
#endif
return (0);
return (FALSE);
}
vr = VA_VREG(va);
vs = VA_VSEG(va);
@ -6005,7 +6006,7 @@ pmap_extract4_4c(pm, va)
if (pmapdebug & PDB_FOLLOW)
printf("pmap_extract: invalid segment (%d)\n", vr);
#endif
return (0);
return (FALSE);
}
sp = &rp->rg_segmap[vs];
@ -6031,7 +6032,7 @@ pmap_extract4_4c(pm, va)
if (pmapdebug & PDB_FOLLOW)
printf("pmap_extract: invalid segment\n");
#endif
return (0);
return (FALSE);
}
tpte = pte[VA_VPG(va)];
}
@ -6040,11 +6041,13 @@ pmap_extract4_4c(pm, va)
if (pmapdebug & PDB_FOLLOW)
printf("pmap_extract: invalid pte\n");
#endif
return (0);
return (FALSE);
}
tpte &= PG_PFNUM;
tpte = tpte;
return ((tpte << PGSHIFT) | (va & PGOFSET));
if (pap != NULL)
*pap = (tpte << PGSHIFT) | (va & PGOFSET);
return (TRUE);
}
#endif /*4,4c*/
@ -6054,10 +6057,11 @@ pmap_extract4_4c(pm, va)
* with the given map/virtual_address pair.
* GRR, the vm code knows; we should not have to do this!
*/
paddr_t
pmap_extract4m(pm, va)
boolean_t
pmap_extract4m(pm, va, pap)
struct pmap *pm;
vaddr_t va;
paddr_t *pap;
{
struct regmap *rm;
struct segmap *sm;
@ -6068,7 +6072,7 @@ pmap_extract4m(pm, va)
if (pmapdebug & PDB_FOLLOW)
printf("pmap_extract: null pmap\n");
#endif
return (0);
return (FALSE);
}
if ((rm = pm->pm_regmap) == NULL) {
@ -6076,7 +6080,7 @@ pmap_extract4m(pm, va)
if (pmapdebug & PDB_FOLLOW)
printf("pmap_extract: no regmap entry\n");
#endif
return (0);
return (FALSE);
}
rm += VA_VREG(va);
@ -6085,7 +6089,7 @@ pmap_extract4m(pm, va)
if (pmapdebug & PDB_FOLLOW)
printf("pmap_extract: no segmap\n");
#endif
return (0);
return (FALSE);
}
sm += VA_VSEG(va);
@ -6094,7 +6098,7 @@ pmap_extract4m(pm, va)
if (pmapdebug & PDB_FOLLOW)
printf("pmap_extract: no ptes\n");
#endif
return (0);
return (FALSE);
}
pte = sm->sg_pte[VA_SUN4M_VPG(va)];
@ -6104,10 +6108,13 @@ pmap_extract4m(pm, va)
printf("pmap_extract: invalid pte of type %d\n",
pte & SRMMU_TETYPE);
#endif
return (0);
return (FALSE);
}
return (ptoa((pte & SRMMU_PPNMASK) >> SRMMU_PPNSHIFT) | VA_OFF(va));
if (pap != NULL)
*pap = ptoa((pte & SRMMU_PPNMASK) >> SRMMU_PPNSHIFT) |
VA_OFF(va);
return (TRUE);
}
#endif /* sun4m */

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.47 1999/05/26 22:19:38 thorpej Exp $ */
/* $NetBSD: vm_machdep.c,v 1.48 1999/07/08 18:08:59 thorpej Exp $ */
/*
* Copyright (c) 1996
@ -81,8 +81,7 @@ pagemove(from, to, size)
if (size & CLOFSET || (int)from & CLOFSET || (int)to & CLOFSET)
panic("pagemove 1");
while (size > 0) {
pa = pmap_extract(pmap_kernel(), (vaddr_t)from);
if (pa == 0)
if (pmap_extract(pmap_kernel(), (vaddr_t)from, &pa) == FALSE)
panic("pagemove 2");
pmap_remove(pmap_kernel(),
(vaddr_t)from, (vaddr_t)from + PAGE_SIZE);
@ -137,8 +136,7 @@ vmapbuf(bp, len)
upmap = vm_map_pmap(&bp->b_proc->p_vmspace->vm_map);
kpmap = vm_map_pmap(kernel_map);
do {
pa = pmap_extract(upmap, uva);
if (pa == 0)
if (pmap_extract(upmap, uva, &pa) == FALSE)
panic("vmapbuf: null page frame");
/* Now map the page into kernel space. */
pmap_enter(kpmap, kva, pa | PMAP_NC,

View File

@ -1,4 +1,4 @@
/* $NetBSD: ebus_bus.c,v 1.2 1999/06/07 05:28:03 eeh Exp $ */
/* $NetBSD: ebus_bus.c,v 1.3 1999/07/08 18:08:59 thorpej Exp $ */
/*
* Copyright (c) 1999 Matthew R. Green
@ -643,7 +643,7 @@ ebus_dmamap_load(t, map, buf, buflen, p, flags)
/*
* Get the physical address for this page.
*/
if ((curaddr = (bus_addr_t)pmap_extract(pmap, (vaddr_t)vaddr)) == NULL) {
if (pmap_extract(pmap, (vaddr_t)vaddr, &curaddr) == FALSE) {
bus_dmamap_unload(t, map);
return (-1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: iommu.c,v 1.2 1999/06/20 00:51:29 eeh Exp $ */
/* $NetBSD: iommu.c,v 1.3 1999/07/08 18:08:59 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -150,7 +150,8 @@ iommu_init(name, is, tsbsize)
is->is_dvmabase = IOTSB_VSTART(is->is_tsbsize) + NBPG;
is->is_tsbsize = tsbsize;
is->is_tsb = malloc(NBPG, M_DMAMAP, M_WAITOK); /* XXX */
is->is_ptsb = pmap_extract(pmap_kernel(), (vaddr_t)is->is_tsb);
(void) pmap_extract(pmap_kernel(), (vaddr_t)is->is_tsb,
(paddr_t *)&is->is_ptsb);
#ifdef DEBUG
if (iommudebug & IDB_DVMA)
@ -172,7 +173,8 @@ iommu_init(name, is, tsbsize)
/*
* Initialize streaming buffer.
*/
is->is_flushpa = pmap_extract(pmap_kernel(), (vaddr_t)&is->is_flush);
(void) pmap_extract(pmap_kernel(), (vaddr_t)&is->is_flush,
(paddr_t *)&is->is_flushpa);
/*
* now actually start up the IOMMU

View File

@ -1,4 +1,4 @@
/* $NetBSD: psycho.c,v 1.1 1999/06/04 13:42:14 mrg Exp $ */
/* $NetBSD: psycho.c,v 1.2 1999/07/08 18:08:59 thorpej Exp $ */
/*
* Copyright (c) 1999 Matthew R. Green
@ -473,8 +473,6 @@ psycho_iommu_init(sc)
panic("couldn't malloc iommu name");
snprintf(name, 32, "%s dvma", sc->sc_dev.dv_xname);
DPRINTF(PDB_IOMMU, ("psycho base %p phys %p\n", (long)sc->sc_regs, (long)pmap_extract(pmap_kernel(), (vaddr_t)sc->sc_regs)));
/* XXX XXX XXX FIX ME tsbsize XXX XXX XXX */
iommu_init(name, &sc->sc_is, 0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: psycho_bus.c,v 1.2 1999/06/07 05:28:03 eeh Exp $ */
/* $NetBSD: psycho_bus.c,v 1.3 1999/07/08 18:09:00 thorpej Exp $ */
/*
* Copyright (c) 1999 Matthew R. Green
@ -743,7 +743,7 @@ psycho_dmamap_load(t, map, buf, buflen, p, flags)
/*
* Get the physical address for this page.
*/
if ((curaddr = (bus_addr_t)pmap_extract(pmap, (vaddr_t)vaddr)) == NULL) {
if (pmap_extract(pmap, (vaddr_t)vaddr, &curaddr) == FALSE) {
bus_dmamap_unload(t, map);
return (-1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: sbus.c,v 1.19 1999/06/20 00:51:30 eeh Exp $ */
/* $NetBSD: sbus.c,v 1.20 1999/07/08 18:09:00 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -320,12 +320,6 @@ sbus_attach(parent, self, aux)
sc->sc_is.is_iommu = &sc->sc_sysio->sys_iommu;
sc->sc_is.is_sb = &sc->sc_sysio->sys_strbuf;
#ifdef DEBUG
if (sbusdebug & SDB_DVMA)
printf("sysio base %p phys %p\n",
(long)sc->sc_sysio, (long)pmap_extract(pmap_kernel(), (vaddr_t)sc->sc_sysio));
#endif
/* XXX should have instance number */
iommu_init("SBus dvma", &sc->sc_is, 0);
@ -866,7 +860,7 @@ sbus_dmamap_load(t, map, buf, buflen, p, flags)
/*
* Get the physical address for this page.
*/
if ((curaddr = (bus_addr_t)pmap_extract(pmap, (vaddr_t)vaddr)) == NULL) {
if (pmap_extract(pmap, (vaddr_t)vaddr, &curaddr) == FALSE) {
bus_dmamap_unload(t, map);
return (-1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: clock.c,v 1.14 1999/06/21 06:28:33 mrg Exp $ */
/* $NetBSD: clock.c,v 1.15 1999/07/08 18:09:00 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
@ -204,7 +204,7 @@ clock_map(bh, model)
#if 0
paddr_t pa;
pa = pmap_extract(pmap_kernel(), (vaddr_t)bh);
(void) pmap_extract(pmap_kernel(), (vaddr_t)bh, &pa);
pmap_enter(pmap_kernel(), (vaddr_t)bh, pa, VM_PROT_READ, 1, VM_PROT_READ);
#endif
cl = (struct clockreg *)((long)bh + CLK_MK48T08_OFF);
@ -428,7 +428,7 @@ clk_wenable(onoff)
vaddr_t va = (vaddr_t)clockreg & ~(NBPG-1);
paddr_t pa;
pa = pmap_extract(pmap_kernel(), va);
(void) pmap_extract(pmap_kernel(), va, &pa);
pmap_enter(pmap_kernel(), va, pa, prot, 1, prot);
}
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.48 1999/06/21 01:42:36 eeh Exp $ */
/* $NetBSD: machdep.c,v 1.49 1999/07/08 18:11:00 thorpej Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -1093,7 +1093,7 @@ _bus_dmamap_load(t, map, buf, buflen, p, flags)
while (buflen > 0 && i < map->_dm_segcnt) {
paddr_t pa;
pa = pmap_extract(pmap_kernel(), vaddr);
(void) pmap_extract(pmap_kernel(), vaddr, &pa);
buflen -= NBPG;
vaddr += NBPG;
if (pa == (map->dm_segs[i].ds_addr + map->dm_segs[i].ds_len)

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.41 1999/06/21 01:44:14 eeh Exp $ */
/* $NetBSD: pmap.c,v 1.42 1999/07/08 18:11:00 thorpej Exp $ */
/* #define NO_VCACHE */ /* Don't forget the locked TLB in dostart */
#define HWREF 1
/* #define BOOT_DEBUG */
@ -2096,11 +2096,14 @@ pmap_protect(pm, sva, eva, prot)
* Extract the physical page address associated
* with the given map/virtual_address pair.
* GRR, the vm code knows; we should not have to do this!
*
* XXX XXX XXX Need to deal with the case that the address is NOT MAPPED!
*/
paddr_t
pmap_extract(pm, va)
boolean_t
pmap_extract(pm, va, pap)
register struct pmap *pm;
vaddr_t va;
paddr_t *pap;
{
paddr_t pa;
@ -2116,7 +2119,6 @@ pmap_extract(pm, va)
pa = (pseg_get(pm, va)&TLB_PA_MASK)+(va&PGOFSET);
#ifdef DEBUG
if (pmapdebug & PDB_EXTRACT) {
paddr_t pa;
pa = ldxa(&pm->pm_segs[va_to_seg(va)], ASI_PHYS_CACHED);
printf("pmap_extract: va=%p segs[%ld]=%lx", va, (long)va_to_seg(va), (long)pa);
if (pa) {
@ -2132,7 +2134,9 @@ pmap_extract(pm, va)
}
#endif
}
return pa;
if (pap != NULL)
*pap = pa;
return (TRUE);
}
#if 0

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.18 1999/05/26 22:19:38 thorpej Exp $ */
/* $NetBSD: vm_machdep.c,v 1.19 1999/07/08 18:11:00 thorpej Exp $ */
/*
* Copyright (c) 1996
@ -82,7 +82,7 @@ pagemove(from, to, size)
register caddr_t from, to;
size_t size;
{
register paddr_t pa;
paddr_t pa;
if (size & CLOFSET || (long)from & CLOFSET || (long)to & CLOFSET)
panic("pagemove 1");
@ -90,8 +90,7 @@ pagemove(from, to, size)
cache_flush((caddr_t)from, size);
#endif
while (size > 0) {
pa = pmap_extract(pmap_kernel(), (vaddr_t)from);
if (pa == 0)
if (pmap_extract(pmap_kernel(), (vaddr_t)from, &pa) == FALSE)
panic("pagemove 2");
pmap_remove(pmap_kernel(),
(vaddr_t)from, (vaddr_t)from + PAGE_SIZE);
@ -147,8 +146,7 @@ vmapbuf(bp, len)
upmap = vm_map_pmap(&bp->b_proc->p_vmspace->vm_map);
kpmap = vm_map_pmap(kernel_map);
do {
pa = pmap_extract(upmap, uva);
if (pa == 0)
if (pmap_extract(upmap, uva, &pa) == FALSE)
panic("vmapbuf: null page frame");
/* Now map the page into kernel space. */
pmap_enter(pmap_kernel(), kva,

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.113 1999/06/17 19:23:28 thorpej Exp $ */
/* $NetBSD: pmap.c,v 1.114 1999/07/08 18:11:01 thorpej Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -2863,13 +2863,14 @@ pmap_copy(dst_pmap, src_pmap, dst_addr, len, src_addr)
* with the given map/virtual_address pair.
* Returns zero if VA not valid.
*/
vm_offset_t
pmap_extract(pmap, va)
boolean_t
pmap_extract(pmap, va, pap)
pmap_t pmap;
vm_offset_t va;
paddr_t *pap;
{
int s, sme, segnum, ptenum, pte;
vm_offset_t pa;
paddr_t pa;
pte = 0;
s = splpmap();
@ -2895,7 +2896,7 @@ pmap_extract(pmap, va)
db_printf("pmap_extract: invalid va=0x%lx\n", va);
Debugger();
#endif
pte = 0;
return (FALSE);
}
pa = PG_PA(pte);
#ifdef DIAGNOSTIC
@ -2903,7 +2904,9 @@ pmap_extract(pmap, va)
panic("pmap_extract: not main mem, va=0x%lx\n", va);
}
#endif
return (pa);
if (pap != NULL)
*pap = pa;
return (TRUE);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.53 1999/05/26 22:19:39 thorpej Exp $ */
/* $NetBSD: vm_machdep.c,v 1.54 1999/07/08 18:11:01 thorpej Exp $ */
/*
* Copyright (c) 1994, 1995 Gordon W. Ross
@ -313,17 +313,18 @@ pagemove(from, to, len)
vaddr_t fva = (vaddr_t)from;
vaddr_t tva = (vaddr_t)to;
paddr_t pa;
boolean_t rv;
#ifdef DEBUG
if (len & CLOFSET)
panic("pagemove");
#endif
while (len > 0) {
pa = pmap_extract(kpmap, fva);
rv = pmap_extract(kpmap, fva, &pa);
#ifdef DEBUG
if (pa == 0)
if (rv == FALSE)
panic("pagemove 2");
if (pmap_extract(kpmap, tva) != 0)
if (pmap_extract(kpmap, tva, NULL) == TRUE)
panic("pagemove 3");
#endif
/* pmap_remove does the necessary cache flush.*/
@ -368,8 +369,7 @@ vmapbuf(bp, len)
upmap = vm_map_pmap(&bp->b_proc->p_vmspace->vm_map);
kpmap = vm_map_pmap(kernel_map);
do {
pa = pmap_extract(upmap, uva);
if (pa == 0)
if (pmap_extract(upmap, uva, &pa) == FALSE)
panic("vmapbuf: null page frame");
#ifdef HAVECACHE
/* Flush write-back cache on old mappings. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: dvma.c,v 1.12 1999/03/26 23:41:37 mycroft Exp $ */
/* $NetBSD: dvma.c,v 1.13 1999/07/08 18:11:01 thorpej Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -178,8 +178,9 @@ dvma_mapin(kmem_va, len, canwait)
void * dvma_addr;
vm_offset_t kva, tva;
register int npf, s;
register vm_offset_t pa;
paddr_t pa;
long off, pn;
boolean_t rv;
kva = (u_long)kmem_va;
#ifdef DIAGNOSTIC
@ -234,9 +235,9 @@ dvma_mapin(kmem_va, len, canwait)
* by external bus masters and into the special DVMA space
* in the MC68030 MMU so they may be seen by the CPU.
*/
pa = pmap_extract(pmap_kernel(), kva);
rv = pmap_extract(pmap_kernel(), kva, &pa);
#ifdef DEBUG
if (pa == 0)
if (rv == FALSE)
panic("dvma_mapin: null page frame");
#endif DEBUG

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.47 1999/06/17 19:23:28 thorpej Exp $ */
/* $NetBSD: pmap.c,v 1.48 1999/07/08 18:11:01 thorpej Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -589,7 +589,7 @@ void pmap_reference __P((pmap_t));
boolean_t pmap_is_referenced __P((vm_offset_t));
boolean_t pmap_is_modified __P((vm_offset_t));
void pmap_clear_modify __P((vm_offset_t));
vm_offset_t pmap_extract __P((pmap_t, vm_offset_t));
boolean_t pmap_extract __P((pmap_t, vaddr_t, paddr_t *));
u_int pmap_free_pages __P((void));
#endif /* INCLUDED_IN_PMAP_H */
int pmap_page_index __P((vm_offset_t));
@ -2959,15 +2959,16 @@ pmap_clear_pv(pa, flag)
/* pmap_extract INTERFACE
**
* Return the physical address mapped by the virtual address
* in the specified pmap or 0 if it is not known.
* in the specified pmap.
*
* Note: this function should also apply an exclusive lock
* on the pmap system during its duration.
*/
vm_offset_t
pmap_extract(pmap, va)
pmap_t pmap;
vm_offset_t va;
boolean_t
pmap_extract(pmap, va, pap)
pmap_t pmap;
vaddr_t va;
paddr_t *pap;
{
int a_idx, b_idx, pte_idx;
a_tmgr_t *a_tbl;
@ -2976,32 +2977,39 @@ pmap_extract(pmap, va)
mmu_short_pte_t *c_pte;
if (pmap == pmap_kernel())
return pmap_extract_kernel(va);
return pmap_extract_kernel(va, pap);
if (pmap == NULL)
return 0;
return FALSE;
if (pmap_stroll(pmap, va, &a_tbl, &b_tbl, &c_tbl,
&c_pte, &a_idx, &b_idx, &pte_idx) == FALSE)
return 0;
return FALSE;
if (!MMU_VALID_DT(*c_pte))
return 0;
return FALSE;
return (MMU_PTE_PA(*c_pte));
if (pap != NULL)
*pap = MMU_PTE_PA(*c_pte);
return (TRUE);
}
/* pmap_extract_kernel INTERNAL
**
* Extract a translation from the kernel address space.
*/
vm_offset_t
pmap_extract_kernel(va)
vm_offset_t va;
boolean_t
pmap_extract_kernel(va, pap)
vaddr_t va;
paddr_t *pap;
{
mmu_short_pte_t *pte;
pte = &kernCbase[(u_int) m68k_btop(va - KERNBASE)];
return MMU_PTE_PA(*pte);
if (!MMU_VALID_DT(*pte))
return (FALSE);
if (pap != NULL)
*pap = MMU_PTE_PA(*pte);
return (TRUE);
}
/* pmap_remove_kernel INTERNAL

View File

@ -1,4 +1,4 @@
/* $NetBSD: bus_dma.c,v 1.2 1999/05/25 23:14:09 thorpej Exp $ */
/* $NetBSD: bus_dma.c,v 1.3 1999/07/08 18:11:02 thorpej Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -584,7 +584,7 @@ _bus_dmamap_load_buffer(t, map, buf, buflen, p, flags, lastaddrp, segp, first)
/*
* Get the physical address for this segment.
*/
curaddr = pmap_extract(pmap, (vm_offset_t)vaddr);
(void) pmap_extract(pmap, (vaddr_t)vaddr, &curaddr);
#if 0
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.67 1999/06/30 19:31:33 ragge Exp $ */
/* $NetBSD: pmap.c,v 1.68 1999/07/08 18:11:02 thorpej Exp $ */
/*
* Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden.
* All rights reserved.
@ -719,10 +719,11 @@ if(startpmapdebug)
return(virtuell+(count-pstart)+0x80000000);
}
paddr_t
pmap_extract(pmap, va)
boolean_t
pmap_extract(pmap, va, pap)
pmap_t pmap;
vaddr_t va;
paddr_t *pap;
{
int *pte, sva = (va & 0x3fffffff) >> VAX_PGSHIFT;
@ -736,17 +737,21 @@ if(startpmapdebug)printf("pmap_extract: pmap %p, va %lx\n",pmap, va);
if (va < 0x40000000) {
if (sva > (pmap->pm_p0lr & ~AST_MASK))
return 0;
return FALSE;
pte = (int *)pmap->pm_p0br;
} else if (va & KERNBASE) {
pte = (int *)Sysmap;
} else {
if (sva < pmap->pm_p1lr)
return 0;
return FALSE;
pte = (int *)pmap->pm_p1br;
}
return (pte[sva] & PG_FRAME) << VAX_PGSHIFT;
if (pte[sva] & PG_V) {
if (pap != NULL)
*pap = (pte[sva] & PG_FRAME) << VAX_PGSHIFT;
return (TRUE);
}
return (FALSE);
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: sgmap.c,v 1.2 1999/06/20 00:59:54 ragge Exp $ */
/* $NetBSD: sgmap.c,v 1.3 1999/07/08 18:11:02 thorpej Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -241,12 +241,10 @@ vax_sgmap_load(t, map, buf, buflen, p, flags, sgmap)
* Get the physical address for this segment.
*/
if (p != NULL)
pa = pmap_extract(p->p_vmspace->vm_map.pmap, va);
(void) pmap_extract(p->p_vmspace->vm_map.pmap, va, &pa);
else
pa = kvtophys(va);
if (pa == 0)
panic("vax_sgmap_load");
/*
* Load the current PTE with this page.
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.51 1999/05/26 22:19:39 thorpej Exp $ */
/* $NetBSD: vm_machdep.c,v 1.52 1999/07/08 18:11:02 thorpej Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@ -310,8 +310,7 @@ vmapbuf(bp, len)
tmap = vm_map_pmap(phys_map);
len = len >> VAX_PGSHIFT;
while (len--) {
pa = pmap_extract(fmap, faddr);
if (pa == 0)
if (pmap_extract(fmap, faddr, &pa) == FALSE)
panic("vmapbuf: null page frame for %x", (u_int)faddr);
pmap_enter(tmap, taddr, pa & ~(VAX_NBPG - 1),

View File

@ -1,4 +1,4 @@
/* $NetBSD: intio_dmac.c,v 1.4 1999/03/24 14:07:38 minoura Exp $ */
/* $NetBSD: intio_dmac.c,v 1.5 1999/07/08 18:11:02 thorpej Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -146,8 +146,8 @@ dmac_init_channels(sc)
sc->sc_channels[i].ch_channel = i;
sc->sc_channels[i].ch_name[0] = 0;
sc->sc_channels[i].ch_softc = &sc->sc_dev;
sc->sc_channels[i].ch_map =
(void*) pmap_extract (pmap, (vaddr_t) &dmac_map[i]);
(void) pmap_extract(pmap, (vaddr_t) &dmac_map[i],
(paddr_t *) &sc->sc_channels[i].ch_map);
bus_space_subregion(sc->sc_bst, sc->sc_bht,
DMAC_CHAN_SIZE*i, DMAC_CHAN_SIZE,
&sc->sc_channels[i].ch_bht);

View File

@ -1,4 +1,4 @@
/* $NetBSD: bus.c,v 1.5 1999/05/25 23:14:09 thorpej Exp $ */
/* $NetBSD: bus.c,v 1.6 1999/07/08 18:11:02 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -524,7 +524,7 @@ x68k_bus_dmamap_load_buffer(map, buf, buflen, p, flags,
/*
* Get the physical address for this segment.
*/
curaddr = pmap_extract(pmap, vaddr);
(void) pmap_extract(pmap, vaddr, &curaddr);
/*
* If we're beyond the bounce threshold, notify

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.42 1999/06/28 15:35:04 minoura Exp $ */
/* $NetBSD: pmap.c,v 1.43 1999/07/08 18:11:02 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -456,7 +456,7 @@ pmap_init()
panic("pmap_init: can't allocate data structures");
Segtabzero = (st_entry_t *) addr;
Segtabzeropa = (st_entry_t *) pmap_extract(pmap_kernel(), addr);
(void) pmap_extract(pmap_kernel(), addr, (paddr_t *)&Segtabzeropa);
addr += X68K_STSIZE;
pv_table = (struct pv_entry *) addr;
@ -520,7 +520,8 @@ pmap_init()
(--kpt_pages)->kpt_next = kpt_free_list;
kpt_free_list = kpt_pages;
kpt_pages->kpt_va = addr2;
kpt_pages->kpt_pa = pmap_extract(pmap_kernel(), addr2);
(void) pmap_extract(pmap_kernel(), addr2,
(paddr_t *)&kpt_pages->kpt_pa);
} while (addr != addr2);
PMAP_DPRINTF(PDB_INIT, ("pmap_init: KPT: %ld pages from %lx to %lx\n",
@ -1707,25 +1708,37 @@ pmap_unwire(pmap, va)
* Extract the physical address associated with the given
* pmap/virtual address pair.
*/
paddr_t
pmap_extract(pmap, va)
boolean_t
pmap_extract(pmap, va, pap)
pmap_t pmap;
vaddr_t va;
paddr_t *pap;
{
boolean_t rv = FALSE;
paddr_t pa;
u_int pte;
PMAP_DPRINTF(PDB_FOLLOW,
("pmap_extract(%p, %lx) -> ", pmap, va));
pa = 0;
if (pmap && pmap_ste_v(pmap, va))
pa = *pmap_pte(pmap, va);
if (pa)
pa = (pa & PG_FRAME) | (va & ~PG_FRAME);
PMAP_DPRINTF(PDB_FOLLOW, ("%lx\n", pa));
return (pa);
if (pmap && pmap_ste_v(pmap, va)) {
pte = *(u_int *)pmap_pte(pmap, va);
if (pte) {
pa = (pte & PG_FRAME) | (va & ~PG_FRAME);
if (pap != NULL)
*pap = pa;
rv = TRUE;
}
}
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW) {
if (rv)
printf("%lx\n", pa);
else
printf("failed\n");
}
#endif
return (rv);
}
/*
@ -1888,7 +1901,7 @@ ok:
* We call pmap_remove_entry to take care of invalidating
* ST and Sysptmap entries.
*/
kpa = pmap_extract(pmap, pv->pv_va);
(void) pmap_extract(pmap, pv->pv_va, (paddr_t *)&kpa);
pmap_remove_mapping(pmap, pv->pv_va, PT_ENTRY_NULL,
PRM_TFLUSH|PRM_CFLUSH);
/*
@ -2720,8 +2733,8 @@ pmap_enter_ptpage(pmap, va)
if (pmap->pm_stab == Segtabzero) {
pmap->pm_stab = (st_entry_t *)
uvm_km_zalloc(st_map, X68K_STSIZE);
pmap->pm_stpa = (st_entry_t *)
pmap_extract(pmap_kernel(), (vaddr_t)pmap->pm_stab);
(void) pmap_extract(pmap_kernel(), (vaddr_t)pmap->pm_stab,
(paddr_t *)&pmap->pm_stpa);
#if defined(M68040) || defined(M68060)
#if defined(M68020) || defined(M68030)
if (mmutype == MMU_68040)

View File

@ -1,4 +1,4 @@
/* $NetBSD: sys_machdep.c,v 1.16 1999/03/24 14:07:39 minoura Exp $ */
/* $NetBSD: sys_machdep.c,v 1.17 1999/07/08 18:11:02 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -143,8 +143,9 @@ cachectl1(req, addr, len, p)
#if defined(M68040) || defined(M68060)
if (mmutype == MMU_68040) {
int inc = 0;
int pa = 0, doall = 0;
int doall = 0;
vaddr_t end;
paddr_t pa = 0;
#ifdef COMPAT_HPUX
extern struct emul emul_hpux;
@ -175,9 +176,8 @@ cachectl1(req, addr, len, p)
*/
if (!doall &&
(pa == 0 || ((int)addr & PGOFSET) == 0)) {
pa = pmap_extract(p->p_vmspace->vm_map.pmap,
addr);
if (pa == 0)
if (pmap_extract(p->p_vmspace->vm_map.pmap,
addr, &pa) == FALSE)
doall = 1;
}
switch (req) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.32 1999/04/18 14:39:10 minoura Exp $ */
/* $NetBSD: trap.c,v 1.33 1999/07/08 18:11:03 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -762,6 +762,7 @@ writeback(fp, docachepush)
int err = 0;
u_int fa;
caddr_t oonfault = p->p_addr->u_pcb.pcb_onfault;
paddr_t pa;
#ifdef DEBUG
if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid)) {
@ -803,7 +804,8 @@ writeback(fp, docachepush)
VM_PROT_WRITE);
fa = (u_int)&vmmap[(f->f_fa & PGOFSET) & ~0xF];
bcopy((caddr_t)&f->f_pd0, (caddr_t)fa, 16);
DCFL(pmap_extract(pmap_kernel(), (paddr_t)fa));
(void) pmap_extract(pmap_kernel(), (paddr_t)fa, &pa);
DCFL(pa);
pmap_remove(pmap_kernel(), (vaddr_t)vmmap,
(vaddr_t)&vmmap[NBPG]);
} else
@ -1025,8 +1027,7 @@ dumpwb(num, s, a, d)
num, a, d, f7sz[(s & SSW4_SZMASK) >> 5],
f7tt[(s & SSW4_TTMASK) >> 3], f7tm[s & SSW4_TMMASK]);
printf(" PA ");
pa = pmap_extract(p->p_vmspace->vm_map.pmap, (paddr_t)a);
if (pa == 0)
if (pmap_extract(p->p_vmspace->vm_map.pmap, (vaddr_t)a, &pa) == FALSE)
printf("<invalid address>");
else
printf("%lx, current value %lx", pa, fuword((caddr_t)a));

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.23 1999/05/26 22:19:39 thorpej Exp $ */
/* $NetBSD: vm_machdep.c,v 1.24 1999/07/08 18:11:03 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -219,17 +219,18 @@ pagemove(from, to, size)
size_t size;
{
paddr_t pa;
boolean_t rv;
#ifdef DEBUG
if (size & CLOFSET)
panic("pagemove");
#endif
while (size > 0) {
pa = pmap_extract(pmap_kernel(), (vaddr_t)from);
rv = pmap_extract(pmap_kernel(), (vaddr_t)from, &pa);
#ifdef DEBUG
if (pa == 0)
if (rv == FALSE)
panic("pagemove 2");
if (pmap_extract(pmap_kernel(), (vaddr_t)to) != 0)
if (pmap_extract(pmap_kernel(), (vaddr_t)to, NULL) == TRUE)
panic("pagemove 3");
#endif
pmap_remove(pmap_kernel(),
@ -287,8 +288,7 @@ kvtop(addr)
{
paddr_t pa;
pa = pmap_extract(pmap_kernel(), (vaddr_t)addr);
if (pa == 0)
if (pmap_extract(pmap_kernel(), (vaddr_t)addr, &pa) == FALSE)
panic("kvtop: zero page frame");
return((int)pa);
}
@ -323,8 +323,7 @@ vmapbuf(bp, len)
upmap = vm_map_pmap(&bp->b_proc->p_vmspace->vm_map);
kpmap = vm_map_pmap(phys_map);
do {
pa = pmap_extract(upmap, uva);
if (pa == 0)
if (pmap_extract(upmap, uva, &pa) == FALSE)
panic("vmapbuf: null page frame");
pmap_enter(kpmap, kva, pa, VM_PROT_READ|VM_PROT_WRITE, TRUE, 0);
uva += PAGE_SIZE;

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_fault.c,v 1.39 1999/06/17 19:23:21 thorpej Exp $ */
/* $NetBSD: uvm_fault.c,v 1.40 1999/07/08 18:11:03 thorpej Exp $ */
/*
*
@ -804,11 +804,10 @@ ReFault:
/*
* dont play with VAs that are already mapped
* except for center)
* XXX: return value of pmap_extract disallows PA 0
*/
if (lcv != centeridx) {
pa = pmap_extract(ufi.orig_map->pmap, currva);
if (pa != NULL) {
if (pmap_extract(ufi.orig_map->pmap, currva, &pa) ==
TRUE) {
pages[lcv] = PGO_DONTCARE;
continue;
}
@ -1801,13 +1800,9 @@ uvm_fault_unwire_locked(map, start, end)
panic("uvm_fault_unwire_locked: address not in map");
for (va = start; va < end ; va += PAGE_SIZE) {
pa = pmap_extract(pmap, va);
/* XXX: assumes PA 0 cannot be in map */
if (pa == (paddr_t) 0) {
if (pmap_extract(pmap, va, &pa) == FALSE)
panic("uvm_fault_unwire_locked: unwiring "
"non-wired memory");
}
/*
* make sure the current entry is for the address we're

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_glue.c,v 1.26 1999/06/17 15:47:22 thorpej Exp $ */
/* $NetBSD: uvm_glue.c,v 1.27 1999/07/08 18:11:03 thorpej Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@ -204,10 +204,9 @@ uvm_chgkprot(addr, len, rw)
* page 0 from an invalid mapping, not that it
* really matters...
*/
pa = pmap_extract(pmap_kernel(), sva|1);
if (pa == 0)
if (pmap_extract(pmap_kernel(), sva, &pa) == FALSE)
panic("chgkprot: invalid page");
pmap_enter(pmap_kernel(), sva, pa&~1, prot, TRUE, 0);
pmap_enter(pmap_kernel(), sva, pa, prot, TRUE, 0);
}
}
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_pager_i.h,v 1.7 1999/03/25 18:48:55 mrg Exp $ */
/* $NetBSD: uvm_pager_i.h,v 1.8 1999/07/08 18:11:03 thorpej Exp $ */
/*
*
@ -58,8 +58,7 @@ uvm_pageratop(kva)
{
paddr_t pa;
pa = pmap_extract(pmap_kernel(), kva);
if (pa == 0)
if (pmap_extract(pmap_kernel(), kva, &pa) == FALSE)
panic("uvm_pageratop");
return (PHYS_TO_VM_PAGE(pa));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.h,v 1.33 1999/06/17 19:23:20 thorpej Exp $ */
/* $NetBSD: pmap.h,v 1.34 1999/07/08 18:11:03 thorpej Exp $ */
/*
* Copyright (c) 1991, 1993
@ -144,7 +144,7 @@ pmap_t pmap_create __P((vsize_t));
void pmap_destroy __P((pmap_t));
void pmap_enter __P((pmap_t,
vaddr_t, paddr_t, vm_prot_t, boolean_t, vm_prot_t));
paddr_t pmap_extract __P((pmap_t, vaddr_t));
boolean_t pmap_extract __P((pmap_t, vaddr_t, paddr_t *));
#if defined(PMAP_NEW) && defined(PMAP_GROWKERNEL)
vaddr_t pmap_growkernel __P((vaddr_t));
#endif