diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2009-05-14 18:54:04 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2009-05-14 18:54:04 +0000 |
commit | ca9985cb791e4e73b27c45963dae91e8ee143f9d (patch) | |
tree | 6f03dcf57d5575c11ec32ebbc58bfeb6b3820955 | |
parent | e7fd3004fc62ea88cc436d0eb825b3cc6a42090c (diff) |
Add two hooks allowing MD code get a MD header to be included if needed,
and to override the way HEAP_START and HEAP_LIMIT are defined.
-rw-r--r-- | sys/lib/libsa/alloc.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/sys/lib/libsa/alloc.c b/sys/lib/libsa/alloc.c index 2f41d683364..64f8a0bc643 100644 --- a/sys/lib/libsa/alloc.c +++ b/sys/lib/libsa/alloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: alloc.c,v 1.9 2003/08/11 06:23:09 deraadt Exp $ */ +/* $OpenBSD: alloc.c,v 1.10 2009/05/14 18:54:03 miod Exp $ */ /* $NetBSD: alloc.c,v 1.6 1997/02/04 18:36:33 thorpej Exp $ */ /* @@ -78,6 +78,12 @@ * * HEAP_START start address of heap (defaults to '&end'). * + * NEEDS_HEAP_H needs to #include "heap.h" to declare things + * needed by HEAP_LIMIT and/or HEAP_START. + * + * NEEDS_HEAP_INIT needs to invoke heap_init() to initialize + * heap boundaries. + * * DEBUG enable debugging sanity checks. */ @@ -111,12 +117,17 @@ struct fl { struct fl *next; } *freelist = (struct fl *)0; +#ifdef NEEDS_HEAP_H +#include "heap.h" +#endif +#ifndef NEEDS_HEAP_INIT #ifdef HEAP_START static char *top = (char *)HEAP_START; #else extern char end[]; static char *top = end; #endif +#endif void * alloc(unsigned int size) @@ -128,6 +139,10 @@ alloc(unsigned int size) char *help; int failed; +#ifdef NEEDS_HEAP_INIT + heap_init(); +#endif + #ifdef ALLOC_TRACE printf("alloc(%u)", size); #endif |