diff options
Diffstat (limited to 'sys/kern/kern_malloc.c')
-rw-r--r-- | sys/kern/kern_malloc.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index 56cff7f..b660aaa 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -51,6 +51,10 @@ #include <vm/pmap.h> #include <vm/vm_map.h> +#if defined(INVARIANTS) && defined(__i386__) +#include <machine/cpu.h> +#endif + MALLOC_DEFINE(M_CACHE, "namecache", "Dynamically allocated cache entries"); MALLOC_DEFINE(M_DEVBUF, "devbuf", "device driver memory"); MALLOC_DEFINE(M_TEMP, "temp", "misc temporary data buffers"); @@ -134,6 +138,11 @@ malloc(size, type, flags) #endif register struct malloc_type *ksp = type; +#if defined(INVARIANTS) && defined(__i386__) + if (flags == M_WAITOK) + KASSERT(intr_nesting_level == 0, + ("malloc(M_WAITOK) in interrupt context")); +#endif /* * Must be at splmem() prior to initializing segment to handle * potential initialization race. |