Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/alpha/alpha Let the caller decide what to do if pma...



details:   https://anonhg.NetBSD.org/src/rev/94a780490bae
branches:  trunk
changeset: 473189:94a780490bae
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon May 24 01:35:54 1999 +0000

description:
Let the caller decide what to do if pmap_physpage_alloc() fails.

diffstat:

 sys/arch/alpha/alpha/pmap.c |  28 +++++++++++++++++-----------
 1 files changed, 17 insertions(+), 11 deletions(-)

diffs (95 lines):

diff -r 57abcf4e9103 -r 94a780490bae sys/arch/alpha/alpha/pmap.c
--- a/sys/arch/alpha/alpha/pmap.c       Mon May 24 00:25:31 1999 +0000
+++ b/sys/arch/alpha/alpha/pmap.c       Mon May 24 01:35:54 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.98 1999/05/23 22:37:02 thorpej Exp $ */
+/* $NetBSD: pmap.c,v 1.99 1999/05/24 01:35:54 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.98 1999/05/23 22:37:02 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.99 1999/05/24 01:35:54 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -517,7 +517,7 @@
 /*
  * Misc. functions.
  */
-paddr_t        pmap_physpage_alloc __P((int));
+boolean_t pmap_physpage_alloc __P((int, paddr_t *));
 void   pmap_physpage_free __P((paddr_t));
 int    pmap_physpage_addref __P((void *));
 int    pmap_physpage_delref __P((void *));
@@ -3201,8 +3201,9 @@
 {
        paddr_t pg;
 
-       pg = pmap_physpage_alloc(PGU_PVENT);
-       return ((void *)ALPHA_PHYS_TO_K0SEG(pg));
+       if (pmap_physpage_alloc(PGU_PVENT, &pg))
+               return ((void *)ALPHA_PHYS_TO_K0SEG(pg));
+       return (NULL);
 }
 
 /*
@@ -3228,9 +3229,10 @@
  *     Allocate a single page from the VM system and return the
  *     physical address for that page.
  */
-paddr_t
-pmap_physpage_alloc(usage)
+boolean_t
+pmap_physpage_alloc(usage, pap)
        int usage;
+       paddr_t *pap;
 {
        struct vm_page *pg;
        struct pv_head *pvh;
@@ -3263,7 +3265,8 @@
 #endif
                        pvh->pvh_usage = usage;
                        simple_unlock(&pvh->pvh_slock);
-                       return (pa);
+                       *pap = pa;
+                       return (TRUE);
                }
 
                /*
@@ -3296,10 +3299,11 @@
         */
        printf("pmap_physpage_alloc: no pages for %s page available after "
            "5 tries\n", pmap_pgu_strings[usage]);
+       return (FALSE);
 #ifdef DIAGNOSTIC
  die:
+       panic("pmap_physpage_alloc");
 #endif
-       panic("pmap_physpage_alloc");
 }
 
 /*
@@ -3436,7 +3440,8 @@
        /*
         * Allocate a page for the level 1 table.
         */
-       ptpa = pmap_physpage_alloc(PGU_L1PT);
+       if (pmap_physpage_alloc(PGU_L1PT, &ptpa) == FALSE)
+               panic("pmap_lev1map_create: no pages available");
        pmap->pm_lev1map = (pt_entry_t *) ALPHA_PHYS_TO_K0SEG(ptpa);
 
        /*
@@ -3536,7 +3541,8 @@
        /*
         * Allocate the page table page.
         */
-       ptpa = pmap_physpage_alloc(usage);
+       if (pmap_physpage_alloc(usage, &ptpa) == FALSE)
+               panic("pmap_ptpage_alloc: no pages available");
 
        /*
         * Initialize the referencing PTE.



Home | Main Index | Thread Index | Old Index