* 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-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.
/* 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
/* 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) \
/* 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
}
#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)
{
if (grub_mm_debug)
grub_printf ("%s:%d: free (%p)\n", file, line, ptr);
+ grub_free (ptr);
}
void *