summaryrefslogtreecommitdiffstats
path: root/linker/ba.h
diff options
context:
space:
mode:
authorIliyan Malchev <malchev@google.com>2009-10-16 17:50:42 -0700
committerIliyan Malchev <malchev@google.com>2009-10-19 18:10:35 -0700
commitaf7315acf6a3a5ac329b04cb543b5d8a95dc26f1 (patch)
tree4a948c38f280ca63a66e06af4f5ea3731775b603 /linker/ba.h
parent7e7d6c48a064af82f0ec39f47b9eb803a6e1df4c (diff)
downloadbionic-af7315acf6a3a5ac329b04cb543b5d8a95dc26f1.zip
bionic-af7315acf6a3a5ac329b04cb543b5d8a95dc26f1.tar.gz
bionic-af7315acf6a3a5ac329b04cb543b5d8a95dc26f1.tar.bz2
bionic/linker: change the buddy allocator to take a handle to the managed area
-- rename struct ba_info to struct ba -- move the static ba descriptor from ba.c to linker.c and rename it ba_prelink -- ba_init, ba_allocate, ba_free, ba_start_addr, and ba_len all take a pointer to struct ba Signed-off-by: Iliyan Malchev <malchev@google.com>
Diffstat (limited to 'linker/ba.h')
-rw-r--r--linker/ba.h31
1 files changed, 26 insertions, 5 deletions
diff --git a/linker/ba.h b/linker/ba.h
index 78f4626..c11017b 100644
--- a/linker/ba.h
+++ b/linker/ba.h
@@ -29,10 +29,31 @@
#ifndef __LINKER_BA_H
#define __LINKER_BA_H
-extern void ba_init(void);
-extern int ba_allocate(unsigned long len);
-extern int ba_free(int index);
-extern unsigned long ba_start_addr(int index);
-extern unsigned long ba_len(int index);
+struct ba_bits {
+ unsigned allocated:1; /* 1 if allocated, 0 if free */
+ unsigned order:7; /* size of the region in ba space */
+};
+
+struct ba {
+ /* start address of the ba space */
+ unsigned long base;
+ /* total size of the ba space */
+ unsigned long size;
+ /* the smaller allocation that can be made */
+ unsigned long min_alloc;
+ /* the order of the largest allocation that can be made */
+ unsigned long max_order;
+ /* number of entries in the ba space */
+ int num_entries;
+ /* the bitmap for the region indicating which entries are allocated
+ * and which are free */
+ struct ba_bits *bitmap;
+};
+
+extern void ba_init(struct ba *ba);
+extern int ba_allocate(struct ba *ba, unsigned long len);
+extern int ba_free(struct ba *ba, int index);
+extern unsigned long ba_start_addr(struct ba *ba, int index);
+extern unsigned long ba_len(struct ba *ba, int index);
#endif