From 0f54a3a55fc405b6373d96d2bf95d51d78be5e0c Mon Sep 17 00:00:00 2001 From: dyson Date: Fri, 5 Dec 1997 05:36:58 +0000 Subject: [PATCH] Some fixes from John Hood: 1) Fix the initialization of malloc structure that changed due to perf opt. 2) Remove unneeded include. 3) An initialization assert added to malloc. Submitted by: John Hood --- sys/ddb/db_input.c | 3 +-- sys/kern/kern_malloc.c | 5 ++++- sys/sys/malloc.h | 5 +++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/sys/ddb/db_input.c b/sys/ddb/db_input.c index 453052a57f1f..857afd637a73 100644 --- a/sys/ddb/db_input.c +++ b/sys/ddb/db_input.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_input.c,v 1.21 1997/11/09 06:30:29 msmith Exp $ + * $Id: db_input.c,v 1.22 1997/11/20 16:53:23 bde Exp $ */ /* @@ -32,7 +32,6 @@ */ #include -#include #include #include diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index 667742003f10..d32a756f0092 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)kern_malloc.c 8.3 (Berkeley) 1/4/94 - * $Id: kern_malloc.c,v 1.36 1997/10/12 20:23:51 phk Exp $ + * $Id: kern_malloc.c,v 1.37 1997/10/28 19:00:53 phk Exp $ */ #include @@ -408,6 +408,9 @@ malloc_init(type) if (type->ks_magic != M_MAGIC) panic("malloc type lacks magic"); + if (cnt.v_page_count == 0) + panic("malloc_init not allowed before vm init"); + /* * Limit maximum memory for each type to 60% of malloc area size or * 60% of physical memory, whichever is smaller. diff --git a/sys/sys/malloc.h b/sys/sys/malloc.h index f0c31f466551..2c1d49334d2a 100644 --- a/sys/sys/malloc.h +++ b/sys/sys/malloc.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)malloc.h 8.5 (Berkeley) 5/3/95 - * $Id: malloc.h,v 1.31 1997/10/28 19:01:02 phk Exp $ + * $Id: malloc.h,v 1.32 1997/12/04 07:29:17 davidg Exp $ */ #ifndef _SYS_MALLOC_H_ @@ -63,7 +63,8 @@ struct malloc_type { }; #define MALLOC_DEFINE(type, shortdesc, longdesc) \ - struct malloc_type type[1] = { { shortdesc, M_MAGIC } }; \ + struct malloc_type type[1] = { { NULL, 0, 0, 0, 0, 0, 0, \ + M_MAGIC, shortdesc, 0, 0 } }; \ struct __hack #define MALLOC_DECLARE(type) \