From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JHfXJ-0006BS-39 for mharc-grub-devel@gnu.org; Wed, 23 Jan 2008 08:21:01 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JHfXH-0006A0-Su for grub-devel@gnu.org; Wed, 23 Jan 2008 08:20:59 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JHfXG-00068R-9T for grub-devel@gnu.org; Wed, 23 Jan 2008 08:20:59 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JHfXG-00068I-3B for grub-devel@gnu.org; Wed, 23 Jan 2008 08:20:58 -0500 Received: from aybabtu.com ([69.60.117.155]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JHfXG-0000J8-0R for grub-devel@gnu.org; Wed, 23 Jan 2008 08:20:58 -0500 Received: from [192.168.10.6] (helo=thorin) by aybabtu.com with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1JHfXC-0005F4-8C for grub-devel@gnu.org; Wed, 23 Jan 2008 14:20:56 +0100 Received: from rmh by thorin with local (Exim 4.63) (envelope-from ) id 1JHfVH-0007gb-V3 for grub-devel@gnu.org; Wed, 23 Jan 2008 14:18:55 +0100 Date: Wed, 23 Jan 2008 14:18:55 +0100 From: Robert Millan To: grub-devel@gnu.org Message-ID: <20080123131855.GA29373@thorin> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="a8Wt8u1KmwUX3Y2C" Content-Disposition: inline Content-Transfer-Encoding: 8bit Organization: free as in freedom X-Message-Flag: Worried about Outlook viruses? Switch to Thunderbird! www.mozilla.com/thunderbird X-Debbugs-No-Ack: true User-Agent: Mutt/1.5.13 (2006-08-11) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [PATCH] use of grub_dprintf in grub_mm_init_region() is misleading X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Jan 2008 13:21:00 -0000 --a8Wt8u1KmwUX3Y2C Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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 I know my rights; I want my phone call! What use is a phone call… if you are unable to speak? (as seen on /.) --a8Wt8u1KmwUX3Y2C Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="mem_dprintf.diff" * 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) --a8Wt8u1KmwUX3Y2C--