Detect if kmem is up, and if not, ignore EX_MALLOCOK.

This commit is contained in:
thorpej 1999-10-11 22:57:17 +00:00
parent 5772f4a756
commit e3203cc4b6

View File

@ -1,4 +1,4 @@
/* $NetBSD: subr_extent.c,v 1.28 1999/06/27 06:18:33 ross Exp $ */
/* $NetBSD: subr_extent.c,v 1.29 1999/10/11 22:57:17 thorpej Exp $ */
/*-
* Copyright (c) 1996, 1998 The NetBSD Foundation, Inc.
@ -49,6 +49,11 @@
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/lock.h>
#include <vm/vm.h>
#include <vm/vm_kern.h>
#define KMEM_IS_RUNNING (kmem_map != NULL)
#elif defined(_EXTENT_TESTING)
/*
* user-land definitions, so it can fit into a testing harness.
@ -70,6 +75,8 @@
#define panic(a) printf(a)
#define splhigh() (1)
#define splx(s) ((void)(s))
#define KMEM_IS_RUNNING (1)
#endif
static pool_handle_t expool_create __P((void));
@ -1000,6 +1007,13 @@ extent_alloc_region_descriptor(ex, flags)
int exflags;
int s;
/*
* If the kernel memory allocator is not yet running, we can't
* use it (obviously).
*/
if (KMEM_IS_RUNNING == 0)
flags &= ~EX_MALLOCOK;
/*
* XXX Make a static, create-time flags word, so we don't
* XXX have to lock to read it!