[syslinux:elflink] elflink: use core/malloc as the malloc system, enlarge buffer to 1MB

syslinux-bot for feng.tang@intel.com feng.tang at intel.com
Thu Aug 12 21:03:14 PDT 2010


Commit-ID:  066fc68f184ed163e36d8cefec965f7a8737e2eb
Gitweb:     http://syslinux.zytor.com/commit/066fc68f184ed163e36d8cefec965f7a8737e2eb
Author:     feng.tang at intel.com <feng.tang at intel.com>
AuthorDate: Wed, 16 Jun 2010 21:39:52 +0800
Committer:  Feng Tang <feng.tang at intel.com>
CommitDate: Tue, 20 Jul 2010 11:10:03 +0800

elflink: use core/malloc as the malloc system, enlarge buffer to 1MB



---
 build.sh           |    3 ++-
 com32/lib/free.c   |    2 ++
 com32/lib/malloc.c |   12 ++++++++++--
 core/mem/init.c    |    3 ++-
 4 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/build.sh b/build.sh
index 63a8b63..8761358 100755
--- a/build.sh
+++ b/build.sh
@@ -1,4 +1,5 @@
-make -j 8 || exit 1
+make -j 4 || exit 1
 cp extlinux/extlinux /home/feng/test/syslinux/
 cp com32/elflink/modules/*.c32 /home/feng/test/syslinux/cd/
 sudo extlinux/extlinux -i /home/feng/test/syslinux/cd/
+qemu -hda /home/feng/test/syslinux/test.img
diff --git a/com32/lib/free.c b/com32/lib/free.c
index fb8fdb4..f58e981 100644
--- a/com32/lib/free.c
+++ b/com32/lib/free.c
@@ -64,6 +64,7 @@ static struct free_arena_header *__free_block(struct free_arena_header *ah)
  * free list.  Only the a.size field of the arena header is assumed
  * to be valid.
  */
+#if 0
 void __inject_free_block(struct free_arena_header *ah)
 {
     struct free_arena_header *nah;
@@ -97,6 +98,7 @@ void __inject_free_block(struct free_arena_header *ah)
 
     __free_block(ah);
 }
+#endif
 
 #if 0
 void free(void *ptr)
diff --git a/com32/lib/malloc.c b/com32/lib/malloc.c
index ba79b65..6cc9681 100644
--- a/com32/lib/malloc.c
+++ b/com32/lib/malloc.c
@@ -52,6 +52,9 @@ static int consider_memory_area(void *dummy, addr_t start,
 
 	end = start + len;
 
+	mp("start = 0x%x, len = 0x%x",
+		start, len);
+
 	if (end > __com32.cs_memsize) {
 	    if (start <= __com32.cs_memsize) {
 		start = __com32.cs_memsize;
@@ -61,7 +64,7 @@ static int consider_memory_area(void *dummy, addr_t start,
 	    if (len >= 2 * sizeof(struct arena_header)) {
 		fp = (struct free_arena_header *)start;
 		fp->a.size = len;
-		mp("will inject a block with size %d", len);
+		mp("will inject a block start:0x%x size 0x%x", start, len);
 		__inject_free_block(fp);
 	    }
 	}
@@ -75,11 +78,16 @@ static void __constructor init_memory_arena(void)
     struct free_arena_header *fp;
     size_t start, total_space;
 
-    mp("enter");
+    //mp("enter");
+
+	mp("skip this init as core has a mem_init");
+    return;
 
     start = (size_t) ARENA_ALIGN_UP(__mem_end);
     total_space = sp() - start;
 
+    mp("start = 0x%x, sp() = 0x%0x, space = 0x%x", start, sp(), total_space);
+
     if (__stack_size == 0 || __stack_size > total_space >> 1)
 	__stack_size = total_space >> 1;	/* Half for the stack, half for the heap... */
 
diff --git a/core/mem/init.c b/core/mem/init.c
index 5063633..497c213 100644
--- a/core/mem/init.c
+++ b/core/mem/init.c
@@ -7,7 +7,8 @@
 
 struct free_arena_header __core_malloc_head[NHEAP];
 
-static __hugebss char main_heap[128 << 10];
+//static __hugebss char main_heap[128 << 10];
+static __hugebss char main_heap[128 << 13];
 extern char __lowmem_heap[];
 
 void mem_init(void)



More information about the Syslinux-commits mailing list