]> git.proxmox.com Git - grub2.git/commitdiff
2007-02-20 Hollis Blanchard <hollis@penguinppc.org>
authorhollisb <hollisb@localhost>
Tue, 20 Feb 2007 22:39:57 +0000 (22:39 +0000)
committerhollisb <hollisb@localhost>
Tue, 20 Feb 2007 22:39:57 +0000 (22:39 +0000)
* kern/mm.c: Update copyright.
(grub_mm_debug): Correct syntax error.
(grub_mm_dump_free): New function.
(grub_debug_free): Call `grub_free'.
* include/grub/mm.h: Update copyright.
(grub_mm_dump_free): Add declaration.

ChangeLog
include/grub/mm.h
kern/mm.c

index a12ce00e8fba38fcfbf64ab666adc4f50a5ee896..9a782a613e27005982ebdd1c5a0cf3ac2160c8e9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-02-20  Hollis Blanchard  <hollis@penguinppc.org>
+
+       * kern/mm.c: Update copyright.
+       (grub_mm_debug): Correct syntax error.
+       (grub_mm_dump_free): New function.
+       (grub_debug_free): Call `grub_free'.
+       * include/grub/mm.h: Update copyright.
+       (grub_mm_dump_free): Add declaration.
+
 2007-02-12  Hollis Blanchard  <hollis@penguinppc.org>
 
        * include/grub/ieee1275/ieee1275.h: Update copyright.
index 81f7eb87524241019b5b6ea0e69f6f5d28b4f2a8..a29fad2373317a1dabf7a7203f4495a17990e06a 100644 (file)
@@ -1,7 +1,7 @@
 /* mm.h - prototypes and declarations for memory manager */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2002  Free Software Foundation, Inc.
+ *  Copyright (C) 2002,2007  Free Software Foundation, Inc.
  *
  *  GRUB is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -40,6 +40,7 @@ void *EXPORT_FUNC(grub_memalign) (grub_size_t align, grub_size_t size);
 /* Set this variable to 1 when you want to trace all memory function calls.  */
 extern int EXPORT_VAR(grub_mm_debug);
 
+void grub_mm_dump_free (void);
 void grub_mm_dump (unsigned lineno);
 
 #define grub_malloc(size)      \
index cf921c8991eacb15fb980af98449f70e11b1a28c..c8a63697645487c14464f547d2c16464a3c6477b 100644 (file)
--- a/kern/mm.c
+++ b/kern/mm.c
@@ -1,7 +1,7 @@
 /* mm.c - functions for memory manager */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2002,2005  Free Software Foundation, Inc.
+ *  Copyright (C) 2002,2005,2007  Free Software Foundation, Inc.
  *
  *  GRUB is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -396,7 +396,33 @@ grub_realloc (void *ptr, grub_size_t size)
 }
 
 #ifdef MM_DEBUG
-grub_mm_debug = 0;
+int grub_mm_debug = 0;
+
+void
+grub_mm_dump_free (void)
+{
+  grub_mm_region_t r;
+
+  for (r = base; r; r = r->next)
+    {
+      grub_mm_header_t p;
+
+      /* Follow the free list.  */
+      p = r->first;
+      do
+       {
+         if (p->magic != GRUB_MM_FREE_MAGIC)
+           grub_fatal ("free magic is broken at %p: 0x%x", p, p->magic);
+
+         grub_printf ("F:%p:%u:%p\n",
+                      p, (unsigned int) p->size << GRUB_MM_ALIGN_LOG2, p->next);
+         p = p->next;
+       }
+      while (p != r->first);
+    }
+
+  grub_printf ("\n");
+}
 
 void
 grub_mm_dump (unsigned lineno)
@@ -447,6 +473,7 @@ grub_debug_free (const char *file, int line, void *ptr)
 {
   if (grub_mm_debug)
     grub_printf ("%s:%d: free (%p)\n", file, line, ptr);
+  grub_free (ptr);
 }
 
 void *