* [PATCH] use of grub_dprintf in grub_mm_init_region() is misleading
@ 2008-01-23 13:18 Robert Millan
2008-01-23 13:53 ` Marco Gerards
0 siblings, 1 reply; 2+ messages in thread
From: Robert Millan @ 2008-01-23 13:18 UTC (permalink / raw)
To: grub-devel
[-- Attachment #1: Type: text/plain, Size: 718 bytes --]
Using grub_dprintf() in grub_mm_init_region() easily leads to think that one
can activate this debug message by issuing `grub_env_set ("debug", "mem")' in
grub_machine_init(), before memory initialisation.
However, that's completely false. grub_env_set will silently [1] ignore your
call because grub_malloc() ain't usable, possibly making you think for a while
that no free memory was found, and that memory was not initialized at all!
I propose turning it into a disabled grub_printf().
[1] well, it'll return an error code. but who remembers about checking that?
--
Robert Millan
<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
[-- Attachment #2: mem_dprintf.diff --]
[-- Type: text/x-diff, Size: 694 bytes --]
* kern/mm.c (grub_mm_init_region): Replace grub_dprintf() call with
#ifdef'ed out grub_printf().
diff -x CVS -x '*~' -x '*.mk' -urp ../grub2/kern/mm.c ./kern/mm.c
--- ../grub2/kern/mm.c 2008-01-21 22:13:11.000000000 +0100
+++ ./kern/mm.c 2008-01-23 13:30:53.000000000 +0100
@@ -143,7 +143,9 @@ grub_mm_init_region (void *addr, grub_si
grub_mm_header_t h;
grub_mm_region_t r, *p, q;
- grub_dprintf ("mem", "Using memory for heap: start=%p, end=%p\n", addr, addr + (unsigned int) size);
+#if 0
+ grub_printf ("Using memory for heap: start=%p, end=%p\n", addr, addr + (unsigned int) size);
+#endif
/* If this region is too small, ignore it. */
if (size < GRUB_MM_ALIGN * 2)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] use of grub_dprintf in grub_mm_init_region() is misleading
2008-01-23 13:18 [PATCH] use of grub_dprintf in grub_mm_init_region() is misleading Robert Millan
@ 2008-01-23 13:53 ` Marco Gerards
0 siblings, 0 replies; 2+ messages in thread
From: Marco Gerards @ 2008-01-23 13:53 UTC (permalink / raw)
To: The development of GRUB 2
Robert Millan <rmh@aybabtu.com> writes:
> Using grub_dprintf() in grub_mm_init_region() easily leads to think that one
> can activate this debug message by issuing `grub_env_set ("debug", "mem")' in
> grub_machine_init(), before memory initialisation.
>
> However, that's completely false. grub_env_set will silently [1] ignore your
> call because grub_malloc() ain't usable, possibly making you think for a while
> that no free memory was found, and that memory was not initialized at all!
>
> I propose turning it into a disabled grub_printf().
Fine for me.
--
Marco
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-01-23 13:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-23 13:18 [PATCH] use of grub_dprintf in grub_mm_init_region() is misleading Robert Millan
2008-01-23 13:53 ` Marco Gerards
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.