From patchwork Wed Nov 11 23:56:26 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: Coreboot bug? Date: Wed, 11 Nov 2009 23:56:26 -0000 From: Myles Watson X-Patchwork-Id: 555 Message-Id: <2831fecf0911111556w2af41be7y4b1afbddec224613@mail.gmail.com> To: coreboot@coreboot.org On Wed, Nov 11, 2009 at 4:37 PM, Peter Stuge 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? /* 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 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));