aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFeng Tang <feng.tang@intel.com>2010-06-08 15:37:49 +0800
committerFeng Tang <feng.tang@intel.com>2010-07-20 11:10:03 +0800
commit9aebffe8214587cf425650834e71329f12f13ba7 (patch)
treef2678dc9d456d5c45a37e30d7eb685d64d61d081
parentff7c5a325bc16720904dc14d3fc2f899205cd4fa (diff)
downloadsyslinux-9aebffe8214587cf425650834e71329f12f13ba7.tar.gz
syslinux-9aebffe8214587cf425650834e71329f12f13ba7.tar.xz
syslinux-9aebffe8214587cf425650834e71329f12f13ba7.zip
elflink: differentiate the 2 malloc system
core and com32 both have their own malloc system, change the name to make them co-exist
-rw-r--r--core/fs/ext2/ext2.c2
-rw-r--r--core/fs/fat/fat.c2
-rw-r--r--core/fs/fs.c2
-rw-r--r--core/fs/iso9660/iso9660.c2
-rw-r--r--core/include/core.h2
-rw-r--r--core/mem/free.c6
-rw-r--r--core/mem/init.c4
-rw-r--r--core/mem/malloc.c4
-rw-r--r--core/mem/malloc.h2
9 files changed, 13 insertions, 13 deletions
diff --git a/core/fs/ext2/ext2.c b/core/fs/ext2/ext2.c
index 716670c6..cf5aaa1d 100644
--- a/core/fs/ext2/ext2.c
+++ b/core/fs/ext2/ext2.c
@@ -280,7 +280,7 @@ static int ext2_fs_init(struct fs_info *fs)
if (sb.s_magic != EXT2_SUPER_MAGIC)
return -1;
- sbi = malloc(sizeof(*sbi));
+ sbi = hmalloc(sizeof(*sbi));
if (!sbi) {
malloc_error("ext2_sb_info structure");
return -1;
diff --git a/core/fs/fat/fat.c b/core/fs/fat/fat.c
index a21f4312..cbcd051b 100644
--- a/core/fs/fat/fat.c
+++ b/core/fs/fat/fat.c
@@ -754,7 +754,7 @@ static int vfat_fs_init(struct fs_info *fs)
/* XXX: Find better sanity checks... */
if (!fat.bxResSectors || !fat.bxFATs)
return -1;
- sbi = malloc(sizeof(*sbi));
+ sbi = hmalloc(sizeof(*sbi));
if (!sbi)
malloc_error("fat_sb_info structure");
fs->fs_info = sbi;
diff --git a/core/fs/fs.c b/core/fs/fs.c
index 3ae12ec9..058a7626 100644
--- a/core/fs/fs.c
+++ b/core/fs/fs.c
@@ -250,7 +250,7 @@ int searchdir(const char *name)
total_len > MAX_SYMLINK_BUF)
goto err;
- linkbuf = malloc(total_len);
+ linkbuf = hmalloc(total_len);
if (!linkbuf)
goto err;
diff --git a/core/fs/iso9660/iso9660.c b/core/fs/iso9660/iso9660.c
index d695e439..428e0cdb 100644
--- a/core/fs/iso9660/iso9660.c
+++ b/core/fs/iso9660/iso9660.c
@@ -307,7 +307,7 @@ static int iso_fs_init(struct fs_info *fs)
struct disk *disk = fs->fs_dev->disk;
int blktosec;
- sbi = malloc(sizeof(*sbi));
+ sbi = hmalloc(sizeof(*sbi));
if (!sbi) {
malloc_error("iso_sb_info structure");
return 1;
diff --git a/core/include/core.h b/core/include/core.h
index eb7bfcdb..f4c85862 100644
--- a/core/include/core.h
+++ b/core/include/core.h
@@ -30,7 +30,7 @@ extern void __idle(void);
extern void reset_idle(void);
/* mem/malloc.c, mem/free.c, mem/init.c */
-extern void *malloc(size_t);
+extern void *hmalloc(size_t);
extern void *lmalloc(size_t);
extern void *pmapi_lmalloc(size_t);
extern void *zalloc(size_t);
diff --git a/core/mem/free.c b/core/mem/free.c
index 0becb9e8..09d08c1c 100644
--- a/core/mem/free.c
+++ b/core/mem/free.c
@@ -13,7 +13,7 @@ __free_block(struct free_arena_header *ah)
{
struct free_arena_header *pah, *nah;
struct free_arena_header *head =
- &__malloc_head[ARENA_HEAP_GET(ah->a.attrs)];
+ &__core_malloc_head[ARENA_HEAP_GET(ah->a.attrs)];
pah = ah->a.prev;
nah = ah->a.next;
@@ -93,7 +93,7 @@ void free(void *ptr)
void __inject_free_block(struct free_arena_header *ah)
{
struct free_arena_header *head =
- &__malloc_head[ARENA_HEAP_GET(ah->a.attrs)];
+ &__core_malloc_head[ARENA_HEAP_GET(ah->a.attrs)];
struct free_arena_header *nah;
size_t a_end = (size_t) ah + ARENA_SIZE_GET(ah->a.attrs);
size_t n_end;
@@ -135,7 +135,7 @@ static void __free_tagged(malloc_tag_t tag) {
for (i = 0; i < NHEAP; i++) {
dprintf("__free_tagged(%u) heap %d\n", tag, i);
- head = &__malloc_head[i];
+ head = &__core_malloc_head[i];
for (fp = head ; fp != head ; fp = fp->a.next) {
if (ARENA_TYPE_GET(fp->a.attrs) == ARENA_TYPE_USED &&
fp->a.tag == tag)
diff --git a/core/mem/init.c b/core/mem/init.c
index 487bbb3f..ce9bd1b6 100644
--- a/core/mem/init.c
+++ b/core/mem/init.c
@@ -3,7 +3,7 @@
#include <string.h>
#include "malloc.h"
-struct free_arena_header __malloc_head[NHEAP];
+struct free_arena_header __core_malloc_head[NHEAP];
static __hugebss char main_heap[128 << 10];
extern char __lowmem_heap[];
@@ -16,7 +16,7 @@ void mem_init(void)
/* Initialize the head nodes */
- fp = &__malloc_head[0];
+ fp = &__core_malloc_head[0];
for (i = 0 ; i < NHEAP ; i++) {
fp->a.next = fp->a.prev = fp->next_free = fp->prev_free = fp;
fp->a.attrs = ARENA_TYPE_HEAD | (i << ARENA_HEAP_POS);
diff --git a/core/mem/malloc.c b/core/mem/malloc.c
index 78f7b41a..b6953ad2 100644
--- a/core/mem/malloc.c
+++ b/core/mem/malloc.c
@@ -60,7 +60,7 @@ static void *__malloc_from_block(struct free_arena_header *fp,
static void *_malloc(size_t size, enum heap heap, malloc_tag_t tag)
{
struct free_arena_header *fp;
- struct free_arena_header *head = &__malloc_head[heap];
+ struct free_arena_header *head = &__core_malloc_head[heap];
void *p = NULL;
dprintf("_malloc(%zu, %u, %u) @ %p = ",
@@ -83,7 +83,7 @@ static void *_malloc(size_t size, enum heap heap, malloc_tag_t tag)
return p;
}
-void *malloc(size_t size)
+void *hmalloc(size_t size)
{
return _malloc(size, HEAP_MAIN, MALLOC_CORE);
}
diff --git a/core/mem/malloc.h b/core/mem/malloc.h
index b8ec44d7..8791349f 100644
--- a/core/mem/malloc.h
+++ b/core/mem/malloc.h
@@ -78,5 +78,5 @@ struct free_arena_header {
size_t _pad[2]; /* Pad to 2*sizeof(struct arena_header) */
};
-extern struct free_arena_header __malloc_head[NHEAP];
+extern struct free_arena_header __core_malloc_head[NHEAP];
void __inject_free_block(struct free_arena_header *ah);