All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix packing issue of machine_mmap_entry
@ 2007-10-22 21:00 Christian Franke
  2007-10-23  5:34 ` Robert Millan
  2007-11-09 14:00 ` Marco Gerards
  0 siblings, 2 replies; 7+ messages in thread
From: Christian Franke @ 2007-10-22 21:00 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 419 bytes --]

First patch related to the Cygwin port:

struct machine_mmap_entry is sensitive to packing of 64 bit values which 
apparently differs between gcc releases.

Christian

2007-10-22  Christian Franke  <franke@computer.org>

	* 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.
	Add compile time assert to check packing.




[-- Attachment #2: grub2-machine_mmap_entry.patch --]
[-- Type: text/x-patch, Size: 691 bytes --]

--- 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 */ 
   grub_uint64_t len;
   grub_uint32_t type;
-};
+} __attribute__((packed));
+
+/* Compile time assert to check packing */
+typedef char ASSERT_sizeof_grub_machine_mmap_entry[
+  sizeof (struct grub_machine_mmap_entry) == 4+8+8+4 ? 1 : -1];
 
 /* Get a memory map entry. Return next continuation value. Zero means
    the end.  */

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-11-18  7:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-22 21:00 [PATCH] Fix packing issue of machine_mmap_entry Christian Franke
2007-10-23  5:34 ` Robert Millan
2007-10-23  8:09   ` Christian Franke
2007-11-09 14:00 ` Marco Gerards
2007-11-09 19:55   ` Christian Franke
2007-11-10 15:55     ` Marco Gerards
2007-11-18  7:11       ` Robert Millan

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.