[coreboot] Coreboot bug?

Myles Watson mylesgw at gmail.com
Thu Nov 12 00:56:26 CET 2009


On Wed, Nov 11, 2009 at 4:37 PM, Peter Stuge <peter at stuge.se> wrote:
> ron minnich wrote:
>> >>> -             memcpy(rec_dest,  rec_src, rec_src->size);
>> >>> +             memcpy(rec_dest,  &option_table, sizeof(option_table));
>>
>> completely changes the behavior of the code and is wrong.
>>
>> I'm willing to be convinced. But sizeof(option_table) is 8
>
> How can that be?
Index: src/arch/i386/boot/coreboot_table.c
===================================================================
--- src/arch/i386/boot/coreboot_table.c	(revision 4935)
+++ src/arch/i386/boot/coreboot_table.c	(working copy)
@@ -488,6 +488,11 @@
 		struct lb_record *rec_dest;
 		/* Copy the option config table, it's already a lb_record... */
 		rec_dest = lb_new_record(head);
+		printk_debug("sizeof(option_table) %lx\n", sizeof(option_table));
+		printk_debug("sizeof(&option_table) %lx\n", sizeof(&option_table));
+		printk_debug("sizeof(rec_dest) %lx\n", sizeof(rec_dest));
+		printk_debug("((u32*)option_table)[0] %x (type)\n",
((u32*)&option_table)[0]);
+		printk_debug("((u32*)option_table)[1] %x (size)\n",
((u32*)&option_table)[1]);
 		memcpy(rec_dest,  &option_table, sizeof(option_table));
 		/* Create cmos checksum entry in coreboot table */
 		lb_cmos_checksum(head);

sizeof(option_table) c
sizeof(&option_table) 4
sizeof(rec_dest) 4
sizeof(*rec_dest) 8
((u32*)option_table)[0] c8 (type)
((u32*)option_table)[1] 488 (size)
memcpy(00000518, 0010d91c, c)

I have no idea why 12.  I reverted it.

We could change it to index it as a u32 array, but I thought it would be easy...

Thanks,
Myles




More information about the coreboot mailing list