Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Change the pmap_extract() interface to:



details:   https://anonhg.NetBSD.org/src/rev/f6dca784e241
branches:  trunk
changeset: 474502:f6dca784e241
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Thu Jul 08 18:05:21 1999 +0000

description:
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.

diffstat:

 sys/arch/alpha/alpha/pmap.c               |  27 +++++++++++------
 sys/arch/alpha/alpha/vm_machdep.c         |   8 ++--
 sys/arch/alpha/common/bus_dma.c           |   8 ++--
 sys/arch/alpha/common/sgmap_typedep.c     |   7 ++-
 sys/arch/amiga/amiga/pmap.c               |  44 ++++++++++++++++++----------
 sys/arch/amiga/amiga/sys_machdep.c        |   7 +--
 sys/arch/amiga/amiga/vm_machdep.c         |  25 +++++++--------
 sys/arch/arm32/arm32/bus_dma.c            |   4 +-
 sys/arch/arm32/arm32/machdep.c            |   8 ++--
 sys/arch/arm32/arm32/pmap.c               |  30 +++++++++++-------
 sys/arch/arm32/iomd/iomd_dma.c            |   6 +-
 sys/arch/arm32/podulebus/esc.c            |   5 +-
 sys/arch/arm32/podulebus/sfas.c           |   5 +-
 sys/arch/arm32/riscpc/rpc_machdep.c       |   6 +-
 sys/arch/arm32/vidc/beep.c                |  10 +++---
 sys/arch/arm32/vidc/console/vidcconsole.c |  13 +++++---
 sys/arch/arm32/vidc/lmcaudio.c            |  26 +++++++++++-----
 sys/arch/arm32/vidc/vidcaudio.c           |  21 ++++++++-----
 sys/arch/atari/atari/bus.c                |   4 +-
 sys/arch/atari/atari/pmap.c               |  47 +++++++++++++++++++-----------
 sys/arch/atari/atari/sys_machdep.c        |   7 +--
 sys/arch/atari/atari/trap.c               |   9 +++--
 sys/arch/atari/atari/vm_machdep.c         |  17 +++++-----
 sys/arch/bebox/bebox/bus_dma.c            |   4 +-
 sys/arch/hp300/hp300/pmap.c               |  46 +++++++++++++++++++----------
 sys/arch/hp300/hp300/sys_machdep.c        |   7 +--
 sys/arch/hp300/hp300/trap.c               |   9 +++--
 sys/arch/hp300/hp300/vm_machdep.c         |  15 ++++-----
 sys/arch/i386/i386/machdep.c              |   7 ++-
 sys/arch/i386/i386/pmap.c                 |  18 +++++-----
 sys/arch/i386/i386/vm_machdep.c           |  13 +++----
 sys/arch/m68k/m68k/mappedcopy.c           |   8 +---
 sys/arch/mac68k/dev/ite.c                 |   5 +-
 sys/arch/mac68k/mac68k/bus_space.c        |   5 +-
 sys/arch/mac68k/mac68k/pmap.c             |  45 +++++++++++++++++++----------
 sys/arch/mac68k/mac68k/trap.c             |   9 +++--
 sys/arch/mac68k/mac68k/vm_machdep.c       |  15 ++++-----
 sys/arch/mac68k/obio/asc.c                |   4 +-
 sys/arch/macppc/macppc/bus_dma.c          |   6 +-
 sys/arch/macppc/macppc/machdep.c          |  13 ++++---
 sys/arch/mips/mips/pmap.c                 |  20 +++++++-----
 sys/arch/mips/mips/vm_machdep.c           |   8 ++--
 sys/arch/mvme68k/dev/if_ie.c              |   6 +-
 sys/arch/mvme68k/mvme68k/pmap.c           |  47 +++++++++++++++++++-----------
 sys/arch/mvme68k/mvme68k/sys_machdep.c    |   7 +--
 sys/arch/mvme68k/mvme68k/trap.c           |   9 +++--
 sys/arch/mvme68k/mvme68k/vm_machdep.c     |  19 +++++------
 sys/arch/next68k/dev/bus_dma.c            |  10 +++---
 sys/arch/next68k/next68k/pmap.c           |  45 +++++++++++++++++++----------
 sys/arch/next68k/next68k/sys_machdep.c    |  10 +++---
 sys/arch/next68k/next68k/trap.c           |   9 +++--
 sys/arch/next68k/next68k/vm_machdep.c     |  19 +++++------
 sys/arch/pc532/pc532/pmap.c               |  18 +++++-----
 sys/arch/pc532/pc532/vm_machdep.c         |  13 +++----
 sys/arch/pmax/pmax/bus_dma.c              |   6 +-
 sys/arch/powerpc/include/pmap.h           |   4 +-
 sys/arch/powerpc/powerpc/pmap.c           |  20 ++++++------
 sys/arch/powerpc/powerpc/vm_machdep.c     |  15 +++++---
 sys/arch/sparc/dev/if_ie_obio.c           |   5 +-
 sys/arch/sparc/dev/vme_machdep.c          |   4 +-
 sys/arch/sparc/include/pmap.h             |   8 ++--
 sys/arch/sparc/sparc/iommu.c              |  10 +++--
 sys/arch/sparc/sparc/machdep.c            |   5 +-
 sys/arch/sparc/sparc/pmap.c               |  45 +++++++++++++++++------------
 sys/arch/sparc/sparc/vm_machdep.c         |   8 +---
 sys/arch/sparc64/dev/ebus_bus.c           |   4 +-
 sys/arch/sparc64/dev/iommu.c              |   8 +++-
 sys/arch/sparc64/dev/psycho.c             |   4 +-
 sys/arch/sparc64/dev/psycho_bus.c         |   4 +-
 sys/arch/sparc64/dev/sbus.c               |  10 +-----
 sys/arch/sparc64/sparc64/clock.c          |   6 +-
 sys/arch/sparc64/sparc64/machdep.c        |   4 +-
 sys/arch/sparc64/sparc64/pmap.c           |  14 +++++---
 sys/arch/sparc64/sparc64/vm_machdep.c     |  10 ++---
 sys/arch/sun3/sun3/pmap.c                 |  15 +++++---
 sys/arch/sun3/sun3/vm_machdep.c           |  12 +++---
 sys/arch/sun3/sun3x/dvma.c                |   9 +++--
 sys/arch/sun3/sun3x/pmap.c                |  42 ++++++++++++++++-----------
 sys/arch/vax/vax/bus_dma.c                |   4 +-
 sys/arch/vax/vax/pmap.c                   |  19 +++++++----
 sys/arch/vax/vax/sgmap.c                  |   6 +--
 sys/arch/vax/vax/vm_machdep.c             |   5 +-
 sys/arch/x68k/dev/intio_dmac.c            |   6 +-
 sys/arch/x68k/x68k/bus.c                  |   4 +-
 sys/arch/x68k/x68k/pmap.c                 |  47 +++++++++++++++++++-----------
 sys/arch/x68k/x68k/sys_machdep.c          |  10 +++---
 sys/arch/x68k/x68k/trap.c                 |   9 +++--
 sys/arch/x68k/x68k/vm_machdep.c           |  15 ++++-----
 sys/uvm/uvm_fault.c                       |  13 ++-----
 sys/uvm/uvm_glue.c                        |   7 +--
 sys/uvm/uvm_pager_i.h                     |   5 +-
 sys/vm/pmap.h                             |   4 +-
 92 files changed, 685 insertions(+), 554 deletions(-)

diffs (truncated from 3674 to 300 lines):

diff -r d9891c405bae -r f6dca784e241 sys/arch/alpha/alpha/pmap.c
--- a/sys/arch/alpha/alpha/pmap.c       Thu Jul 08 17:37:35 1999 +0000
+++ b/sys/arch/alpha/alpha/pmap.c       Thu Jul 08 18:05:21 1999 +0000
@@ -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 @@
  *     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;
+       int ps;
        paddr_t pa;
-       int ps;
+       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 @@
                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);
 }
 
 /*
diff -r d9891c405bae -r f6dca784e241 sys/arch/alpha/alpha/vm_machdep.c
--- a/sys/arch/alpha/alpha/vm_machdep.c Thu Jul 08 17:37:35 1999 +0000
+++ b/sys/arch/alpha/alpha/vm_machdep.c Thu Jul 08 18:05:21 1999 +0000
@@ -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 @@
        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);
diff -r d9891c405bae -r f6dca784e241 sys/arch/alpha/common/bus_dma.c
--- a/sys/arch/alpha/common/bus_dma.c   Thu Jul 08 17:37:35 1999 +0000
+++ b/sys/arch/alpha/common/bus_dma.c   Thu Jul 08 18:05:21 1999 +0000
@@ -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 @@
                 * 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);
 
diff -r d9891c405bae -r f6dca784e241 sys/arch/alpha/common/sgmap_typedep.c
--- a/sys/arch/alpha/common/sgmap_typedep.c     Thu Jul 08 17:37:35 1999 +0000
+++ b/sys/arch/alpha/common/sgmap_typedep.c     Thu Jul 08 18:05:21 1999 +0000
@@ -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 @@
                 * 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);
 
diff -r d9891c405bae -r f6dca784e241 sys/arch/amiga/amiga/pmap.c
--- a/sys/arch/amiga/amiga/pmap.c       Thu Jul 08 17:37:35 1999 +0000
+++ b/sys/arch/amiga/amiga/pmap.c       Thu Jul 08 18:05:21 1999 +0000
@@ -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 @@
        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 @@
                (--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 @@
  *             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 @@
                 * 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 @@
                /* 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)
diff -r d9891c405bae -r f6dca784e241 sys/arch/amiga/amiga/sys_machdep.c
--- a/sys/arch/amiga/amiga/sys_machdep.c        Thu Jul 08 17:37:35 1999 +0000
+++ b/sys/arch/amiga/amiga/sys_machdep.c        Thu Jul 08 18:05:21 1999 +0000
@@ -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 @@
                         */
                        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) {
diff -r d9891c405bae -r f6dca784e241 sys/arch/amiga/amiga/vm_machdep.c
--- a/sys/arch/amiga/amiga/vm_machdep.c Thu Jul 08 17:37:35 1999 +0000
+++ b/sys/arch/amiga/amiga/vm_machdep.c Thu Jul 08 18:05:21 1999 +0000
@@ -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 @@
        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)



Home | Main Index | Thread Index | Old Index