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.
This commit is contained in:
parent
077d5fee0a
commit
3ce27299eb
3 changed files with 40 additions and 3 deletions
|
@ -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.
|
||||
|
|
|
@ -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) \
|
||||
|
|
31
kern/mm.c
31
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 *
|
||||
|
|
Loading…
Reference in a new issue