Hmm, missing attachment.

ron

On 10/3/07, ron minnich <[EMAIL PROTECTED]> wrote:
> This patch makes qemu work again on v3. FILO was depending on bss
> being zero, which is not all that safe in embedded. It's better to
> zero things you are depending on being zero.
>
> ron
>
This patch makes qemu work again on v3. FILO was depending on bss being zero, which is not all that safe in embedded. It's better to zero things you are depending on being zero.
Signed-off-by: Ronald G. Minnich <[EMAIL PROTECTED]>

Index: main/malloc.c
===================================================================
--- main/malloc.c	(revision 35)
+++ main/malloc.c	(working copy)
@@ -43,8 +43,10 @@
 static unsigned long total_free, total_alloc;
 static unsigned int count_free, count_alloc;
 
+/* FILO should not count on bss being zero. That's dangerous */
 static void malloc_init(void)
 {
+    memset(&_heap, 0, heap_end - heap_start);
     head = (struct block_header *) ALIGN(heap_start);
     head->prev_size = INUSE;
     head->size = ((heap_end & ~(ALIGNMENT-1)) - ALIGN(heap_start))
@@ -70,9 +72,11 @@
 {
     struct block_header *p, *new_space;
     unsigned long required, largest, remainder;
-
-    if (!head)
+    static int firsttime = 1;
+    if (firsttime) {
 	malloc_init();
+	firsttime = 0;
+    }
 
 #ifdef DEBUG
     malloc_check();
Index: i386/segment.c
===================================================================
--- i386/segment.c	(revision 35)
+++ i386/segment.c	(working copy)
@@ -49,7 +49,6 @@
     unsigned d0, d1, d2;
     struct gdtarg gdtarg;
 #define ALIGNMENT 16
-
     prog_addr = virt_to_phys(&_start);
     prog_size = virt_to_phys(&_end) - virt_to_phys(&_start);
     debug("Current location: %#lx-%#lx\n", prog_addr, prog_addr+prog_size-1);
-- 
linuxbios mailing list
linuxbios@linuxbios.org
http://www.linuxbios.org/mailman/listinfo/linuxbios

Reply via email to