From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1IqZxU-0004ZJ-6n for mharc-grub-devel@gnu.org; Fri, 09 Nov 2007 14:56:04 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IqZxS-0004Xd-QK for grub-devel@gnu.org; Fri, 09 Nov 2007 14:56:02 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IqZxR-0004Vn-JV for grub-devel@gnu.org; Fri, 09 Nov 2007 14:56:02 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IqZxR-0004Vf-DE for grub-devel@gnu.org; Fri, 09 Nov 2007 14:56:01 -0500 Received: from mailout05.sul.t-online.de ([194.25.134.82] helo=mailout05.sul.t-online.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IqZxR-0002j3-09 for grub-devel@gnu.org; Fri, 09 Nov 2007 14:56:01 -0500 Received: from fwd34.aul.t-online.de by mailout05.sul.t-online.com with smtp id 1IqZxP-00039d-06; Fri, 09 Nov 2007 20:55:59 +0100 Received: from [10.3.2.2] (JbOVqTZ6whIotBh9QjaGRURonuqSCPxc2uHojFKMq7BYT0wjHXP2GmaJxRBISHmglZ@[217.235.206.191]) by fwd34.aul.t-online.de with esmtp id 1IqZxB-1P0KPo0; Fri, 9 Nov 2007 20:55:45 +0100 Message-ID: <4734BB45.2030909@t-online.de> Date: Fri, 09 Nov 2007 20:55:49 +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: <471D0F5B.20805@t-online.de> <87hcjvmsc7.fsf@xs4all.nl> In-Reply-To: <87hcjvmsc7.fsf@xs4all.nl> Content-Type: multipart/mixed; boundary="------------080905080000030006020501" X-ID: JbOVqTZ6whIotBh9QjaGRURonuqSCPxc2uHojFKMq7BYT0wjHXP2GmaJxRBISHmglZ X-TOI-MSGID: 301e5329-964b-456c-a4cf-efa65fb720fc X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Subject: Re: [PATCH] Fix packing issue of machine_mmap_entry 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 19:56:03 -0000 This is a multi-part message in MIME format. --------------080905080000030006020501 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Marco Gerards wrote: >> ... >> Add compile time assert to check packing. >> > > Can you remove the compile time assert? Done. > We usually check stuff like > this using configure. If you can send in a patch for configure.ac, > that would be appreciated. > > Yes, but be patient. The configure approach is quite different: In configure, you can check whether compiler supports attr packed and whether it works as expected. With the good old typedef compile time assert, you can check whether this *specific* structure is properly declared and packed. >> --- grub2.orig/include/grub/i386/pc/init.h 2007-07-22 01:32:23.000000000 +0200 >> +++ grub2/include/grub/i386/pc/init.h 2007-10-13 21:25:24.000000000 +0200 >> @@ -40,10 +40,14 @@ grub_uint32_t grub_get_eisa_mmap (void); >> struct grub_machine_mmap_entry >> { >> grub_uint32_t size; >> - grub_uint64_t addr; >> + grub_uint64_t addr; /* must be at offset 4, see startup.S */ >> > > I do not think this comment is required. It's fixed now :-) > > Hmm...OK removed. Now there is no clue why this struct has packing requirements. And this also is no longer checked. Christian 2007-11-09 Christian Franke * include/grub/i386/pc/init.h (struct grub_machine_mmap_entry): Add attribute packed, gcc 3.4.4 on Cygwin aligns this to 64 bit boundary by default. --------------080905080000030006020501 Content-Type: text/x-patch; name="grub2-machine_mmap_entry-2.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="grub2-machine_mmap_entry-2.patch" --- grub2.orig/include/grub/i386/pc/init.h 2007-10-31 23:55:57.093750000 +0100 +++ grub2/include/grub/i386/pc/init.h 2007-11-09 20:27:52.312500000 +0100 @@ -39,7 +39,7 @@ grub_uint64_t addr; grub_uint64_t len; grub_uint32_t type; -}; +} __attribute__((packed)); /* Get a memory map entry. Return next continuation value. Zero means the end. */ --------------080905080000030006020501--