From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1IqbnC-00011O-OO for mharc-grub-devel@gnu.org; Fri, 09 Nov 2007 16:53:34 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IqbnA-0000yF-Hf for grub-devel@gnu.org; Fri, 09 Nov 2007 16:53:32 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Iqbn8-0000vt-Vh for grub-devel@gnu.org; Fri, 09 Nov 2007 16:53:32 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Iqbn8-0000vh-Sp for grub-devel@gnu.org; Fri, 09 Nov 2007 16:53:30 -0500 Received: from mailout07.sul.t-online.de ([194.25.134.83] helo=mailout07.sul.t-online.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Iqbn8-0004od-77 for grub-devel@gnu.org; Fri, 09 Nov 2007 16:53:30 -0500 Received: from fwd28.aul.t-online.de by mailout07.sul.t-online.com with smtp id 1Iqbn7-0002WC-00; Fri, 09 Nov 2007 22:53:29 +0100 Received: from [10.3.2.2] (V+h+SZZZ8hmbtisE9FABS4kZfROUsWueXYiPWG60RhGw054jZBdij8xSkhAynJvQOi@[217.235.206.191]) by fwd28.aul.t-online.de with esmtp id 1Iqbmx-1obWi00; Fri, 9 Nov 2007 22:53:19 +0100 Message-ID: <4734D6D3.9020307@t-online.de> Date: Fri, 09 Nov 2007 22:53:23 +0100 From: Christian Franke User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070802 SeaMonkey/1.1.4 MIME-Version: 1.0 To: The development of GRUB 2 References: <471E4628.9030706@t-online.de> <20071109205125.GA23437@thorin> In-Reply-To: <20071109205125.GA23437@thorin> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-ID: V+h+SZZZ8hmbtisE9FABS4kZfROUsWueXYiPWG60RhGw054jZBdij8xSkhAynJvQOi X-TOI-MSGID: 96f0970f-32cc-4412-863e-d7e3437a0190 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Subject: Re: [PATCH] Fix eisa_mmap evaluation, add memory existence check 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: Fri, 09 Nov 2007 21:53:33 -0000 Robert Millan wrote: > On Tue, Oct 23, 2007 at 09:06:16PM +0200, Christian Franke wrote: > >> +/* Check memory address */ >> +static int >> +addr_is_valid (grub_addr_t addr) >> +{ >> + volatile unsigned char * p = (volatile unsigned char *)addr; >> + unsigned char x, y; >> + x = *p; >> + *p = x ^ 0xcf; >> + y = *p; >> + *p = x; >> + return y == (x ^ 0xcf); >> +} >> + >> > > I have a feeling this might be dangerous. Any comments on the warnings > listed here: > > http://www.osdev.org/wiki/How_Do_I_Determine_The_Amount_Of_RAM#Counting_RAM_by_direct_probing > > ? > > Specially the bit about memory-mapped PCI. > This code does not check any memory-mapped PCI. It does only check the boundary returned by the BIOS memory map evaluation code (which didn't work in the E801 case). Definitely not mandatory, but a IMO recommended assert-type check for experimental code. > Besides, if we really want it, perhaps it should be in a separate file so that > other ports can use it if it's needed ? > Good point. > Ah, and why 0xcf instead of 0xff ? > > ... or 0xaa or 0x55. c.f. :-)