[coreboot] r783 - coreboot-v3/arch/x86

ron minnich rminnich at gmail.com
Mon Aug 18 18:05:15 CEST 2008


On Mon, Aug 18, 2008 at 7:35 AM, Carl-Daniel Hailfinger
<c-d.hailfinger.devel.2006 at gmx.net> wrote:
> On 18.08.2008 15:56, Stefan Reinauer wrote:
>> Carl-Daniel Hailfinger asked:
>>
>>>
>>> -    /* we can't statically init this hack. */
>>> +    /* Why can't we statically init this hack? */
>>>
>>>
>> No global variables in stage 1.
>>
>
> Hm. The variable is only used locally. We could at least use automatic
> init for it.
>
> Now I see it. The reason is that we would get a buffer overflow. Nasty.

That's not really it. The issue is that a static initiializer in
stage1 requires data space we don't have in stage1, so I made it code.


> struct lb_memory has a zero-sized map array, but we use one element.
> struct lb_memory {
>        u32 tag;
>        u32 size;
>        struct lb_memory_range map[0];
> };
>
> The fix is to declare
> struct lb_memory_one_map {
>        u32 tag;
>        u32 size;
>        struct lb_memory_range map[1];
> };
> and cast it to struct lb_memory.

Turns out you do need this, ignore earlier email :-)

Actually, given all this ugliness, can we kill the ELF loader? This
would solve this mess. :-)

ron




More information about the coreboot mailing list