From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38294) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UydFR-0001q3-I1 for qemu-devel@nongnu.org; Mon, 15 Jul 2013 03:31:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UydFO-0007a1-Go for qemu-devel@nongnu.org; Mon, 15 Jul 2013 03:31:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48254) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UydFO-0007Zw-8V for qemu-devel@nongnu.org; Mon, 15 Jul 2013 03:31:02 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r6F7V0Qo029223 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 15 Jul 2013 03:31:00 -0400 Message-ID: <51E3A5C5.6080804@redhat.com> Date: Mon, 15 Jul 2013 09:33:25 +0200 From: Laszlo Ersek MIME-Version: 1.0 References: <1373464153-18979-1-git-send-email-mst@redhat.com> <1373464153-18979-6-git-send-email-mst@redhat.com> <51E00FF8.1030606@redhat.com> <20130714114159.GE21613@redhat.com> In-Reply-To: <20130714114159.GE21613@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 repost 5/9] i386: add bios linker/loader List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org 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