From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58709) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uyedz-0000DE-26 for qemu-devel@nongnu.org; Mon, 15 Jul 2013 05:00:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uyedv-0003Rd-Pm for qemu-devel@nongnu.org; Mon, 15 Jul 2013 05:00:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45432) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uyedv-0003RV-HC for qemu-devel@nongnu.org; Mon, 15 Jul 2013 05:00:27 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r6F90N09003026 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 15 Jul 2013 05:00:26 -0400 Date: Mon, 15 Jul 2013 12:01:28 +0300 From: "Michael S. Tsirkin" Message-ID: <20130715090128.GA677@redhat.com> 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> <51E3A5C5.6080804@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <51E3A5C5.6080804@redhat.com> 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: Laszlo Ersek Cc: qemu-devel@nongnu.org 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