Allow the MD code to decide to panic if cpu_uarea_alloc would return NULL.

If NULL is returned, just allocate the standard way.
This commit is contained in:
matt 2011-07-02 01:26:29 +00:00
parent e8e84f5a1b
commit dd6af2c565
2 changed files with 13 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.91 2011/07/02 00:38:29 matt Exp $ */
/* $NetBSD: vm_machdep.c,v 1.92 2011/07/02 01:26:29 matt Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.91 2011/07/02 00:38:29 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.92 2011/07/02 01:26:29 matt Exp $");
#include "opt_altivec.h"
#include "opt_multiprocessor.h"
@ -298,7 +298,7 @@ cpu_uarea_alloc(bool system)
error = uvm_pglistalloc(USPACE, 0, ptoa(physmem), 0, 0, &pglist, 1, 1);
if (error) {
if (!system)
return (void *)uvm_uarea_alloc();
return NULL;
panic("%s: uvm_pglistalloc failed: %d", __func__, error);
}
@ -315,7 +315,7 @@ cpu_uarea_alloc(bool system)
return (void *)(uintptr_t)PMAP_MAP_POOLPAGE(pa);
#else
return (void *)uvm_uarea_alloc();
return NULL;
#endif
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_glue.c,v 1.150 2011/06/12 03:36:03 rmind Exp $ */
/* $NetBSD: uvm_glue.c,v 1.151 2011/07/02 01:26:29 matt Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uvm_glue.c,v 1.150 2011/06/12 03:36:03 rmind Exp $");
__KERNEL_RCSID(0, "$NetBSD: uvm_glue.c,v 1.151 2011/07/02 01:26:29 matt Exp $");
#include "opt_kgdb.h"
#include "opt_kstack.h"
@ -298,8 +298,13 @@ static void *
uarea_system_poolpage_alloc(struct pool *pp, int flags)
{
void * const va = cpu_uarea_alloc(true);
KASSERT(va != NULL);
return va;
if (va != NULL)
return va;
return (void *)uvm_km_alloc(kernel_map, pp->pr_alloc->pa_pagesz,
USPACE_ALIGN, UVM_KMF_WIRED |
((flags & PR_WAITOK) ? UVM_KMF_WAITVA :
(UVM_KMF_NOWAIT | UVM_KMF_TRYLOCK)));
}
static void