On 3/25/10 5:18 PM, Myles Watson wrote: > >> On Thu, Mar 25, 2010 at 7:56 AM, Myles Watson <myle...@gmail.com> wrote: >> >> >>> It seems like others must have this problem of needing to force a binary >>> blob into a struct. >>> >> Hi, I've only been following this at a distance. I assume this all >> happens after memory is turned on. Why not just have a function to >> fill the struct given the binary blob? I'm starting to worry about all >> the tricks people want to play with gcc. >> > Memory is on. The blob is in flash, and the first bit of the blob is the > header with the length field. > > We do a memcpy from flash to the struct, Actually this is a memcpy from memory to the cbmem area, but after it's copied it's not treated as a struct anymore.
> but first we have to cast it to a > header so we can read out the length to copy. Which makes me think if there are not other ways to determine the size of an array. Maybe sizeof(AmlCode) ? > Gcc doesn't like the cast, so > we just declare that we have the header stored in flash. > > One way to solve it would be to copy the header first, then read the length > and copy the rest... > > That's more copying than my variant with the extra pointer. Since we copied (or uncompressed) the dsdt from flash to ram already before, and are going to make another copy, I suggest rather keeping an extra 4 bytes, than copying the complete header for no apparent reason... Stefan -- coresystems GmbH • Brahmsstr. 16 • D-79104 Freiburg i. Br. Tel.: +49 761 7668825 • Fax: +49 761 7664613 Email: i...@coresystems.de • http://www.coresystems.de/ Registergericht: Amtsgericht Freiburg • HRB 7656 Geschäftsführer: Stefan Reinauer • Ust-IdNr.: DE245674866 -- coreboot mailing list: coreboot@coreboot.org http://www.coreboot.org/mailman/listinfo/coreboot