summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorMichael Brown2006-04-24 17:21:18 +0200
committerMichael Brown2006-04-24 17:21:18 +0200
commitb6b6a0b5fe65620d0dde4f3dd46244baab2cb8a6 (patch)
treee53bd67e7a5caa95858eb44e480aafdeeafc6e6f /src/include
parentAdd "net" directory. (diff)
downloadipxe-b6b6a0b5fe65620d0dde4f3dd46244baab2cb8a6.tar.gz
ipxe-b6b6a0b5fe65620d0dde4f3dd46244baab2cb8a6.tar.xz
ipxe-b6b6a0b5fe65620d0dde4f3dd46244baab2cb8a6.zip
First draft of a dynamic memory allocator
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gpxe/malloc.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/include/gpxe/malloc.h b/src/include/gpxe/malloc.h
new file mode 100644
index 00000000..abb0008a
--- /dev/null
+++ b/src/include/gpxe/malloc.h
@@ -0,0 +1,36 @@
+#ifndef _GPXE_MALLOC_H
+#define _GPXE_MALLOC_H
+
+#include <stdint.h>
+
+/** @file
+ *
+ * Memory allocation
+ *
+ */
+
+extern void * gmalloc ( size_t size );
+extern void gfree ( void *ptr, size_t size );
+extern void gmpopulate ( void *start, size_t len );
+
+/**
+ * Allocate cleared memory
+ *
+ * @v size Requested size
+ * @ret ptr Allocated memory
+ *
+ * Allocate memory as per gmalloc(), and zero it.
+ *
+ * Note that gmalloc() and gcalloc() are identical, in the interests
+ * of reducing code size. Callers should not, however, rely on
+ * gmalloc() clearing memory, since this behaviour may change in
+ * future.
+ */
+static inline void * gcalloc ( size_t size ) {
+ return gmalloc ( size );
+}
+
+/* Debug function; not compiled in by default */
+void gdumpfree ( void );
+
+#endif /* _GPXE_MALLOC_H */