On 07/14/13 13:41, Michael S. Tsirkin wrote:
> On Fri, Jul 12, 2013 at 04:17:28PM +0200, Laszlo Ersek wrote:
>> On 07/10/13 15:51, Michael S. Tsirkin wrote:
>>> +struct BiosLinkerLoaderEntry {
>>> + uint32_t command;
>>> + union {
>>> + /*
>>> + * COMMAND_ALLOCATE - allocate a table from @alloc_file
>>> + * subject to @alloc_align alignment (must be power of 2)
>>> + * and @alloc_zone (can be HIGH or FSEG) requirements.
>>> + *
>>> + * Must appear exactly once for each file, and before
>>> + * this file is referenced by any other command.
>>> + */
>>> + struct {
>>> + char alloc_file[BIOS_LINKER_LOADER_FILESZ];
>>> + uint32_t alloc_align;
>>> + uint8_t alloc_zone;
>>> + };
>>
>> I think in OVMF we won't rely on the alloc_zone / alloc_align members,
>> but that's OVMF's private business.
>
> RSDP must be in FSEG though
I didn't express myself clearly, sorry. The default edk2 ACPI table
protocol that OVMF uses should allocate RSDP and the like automatically
in correct regions. (Allocating reserved memory for
External(XXXX,OpRegionObj) needs a different call though.)
>>> +
>>> + /* padding */
>>> + char pad[124];
>>> + };
>>
>> The unnamed union member is a gcc-ism. I'd give it a short name (like
>> "u"), but feel free to ignore this.
>>
>
> This isn't a gcc-ism. It's in C1x:
>
> An unnamed member whose type specifier is a structure specifier with no
> tag is called an anonymous structure; an unnamed member whose type
> specifier is a union specifier with no tag is called an anonymous union.
> The members of an anonymous structure or union are considered to be
> members of the containing structure or union. This applies recursively
> if the containing structure or union is also anonymous.
This part of the discussion is academic, but the unnamed union member is
a gcc-ism in the qemu source, because AFAIK qemu uses the gnu89 dialect
by default, and gnu99 on Solaris.
>>> +};
>>> +typedef struct BiosLinkerLoaderEntry BiosLinkerLoaderEntry;
>>
>> Probably not needed in practice, but for documentation purposes I
>> suggest QEMU_PACKED from "include/qemu/compiler.h".
>
> It's not required in practice but I can add this though I'm not sure -
> what does this document?
To me it documents that we rely on the absence of inter-member padding.
Thanks
Laszlo