[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Fix packing issue of machine_mmap_entry

From: Christian Franke
Subject: Re: [PATCH] Fix packing issue of machine_mmap_entry
Date: Fri, 09 Nov 2007 20:55:49 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20070802 SeaMonkey/1.1.4

Marco Gerards wrote:

        Add compile time assert to check packing.

Can you remove the compile time assert?


We usually check stuff like
this using configure.  If you can send in a patch for,
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 
+++ 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.


2007-11-09  Christian Franke  <address@hidden>

        * 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.

--- grub2.orig/include/grub/i386/pc/init.h      2007-10-31 23:55:57.093750000 
+++ 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.  */

reply via email to

[Prev in Thread] Current Thread [Next in Thread]