[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 repost 5/9] i386: add bios linker/loader
From: |
Michael S. Tsirkin |
Subject: |
Re: [Qemu-devel] [PATCH v2 repost 5/9] i386: add bios linker/loader |
Date: |
Mon, 15 Jul 2013 12:01:28 +0300 |
On Mon, Jul 15, 2013 at 09:33:25AM +0200, Laszlo Ersek wrote:
> 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.
>
The important thing is that it's part of the standard now,
so won't go away or interfere with porting to a new compiler
if we ever try to do it.
> >>> +};
> >>> +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
- [Qemu-devel] [PATCH v2 repost 3/9] acpi: add rules to compile ASL source, (continued)
[Qemu-devel] [PATCH v2 repost 2/9] i386: add ACPI table files from seabios, Michael S. Tsirkin, 2013/07/10
[Qemu-devel] [PATCH v2 repost 7/9] loader: allow adding ROMs in done callbacks, Michael S. Tsirkin, 2013/07/10
[Qemu-devel] [PATCH v2 repost 6/9] loader: support for unmapped ROM blobs, Michael S. Tsirkin, 2013/07/10