Date: Thu, 22 Jun 2017 21:34:25 +0300 From: Toomas Soome <tsoome@me.com> To: Dimitry Andric <dim@FreeBSD.org> Cc: Ed Maste <emaste@freebsd.org>, src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r320234 - head/sys/boot/efi/include Message-ID: <62AB7B61-DE8C-4CBA-94EA-899A7564E751@me.com> In-Reply-To: <1F8C5886-71FC-486B-9793-E3554843CC65@FreeBSD.org> References: <201706221430.v5MEU9Zc063375@repo.freebsd.org> <1F8C5886-71FC-486B-9793-E3554843CC65@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> On 22. juuni 2017, at 21:23, Dimitry Andric <dim@FreeBSD.org> wrote: >=20 > On 22 Jun 2017, at 16:30, Ed Maste <emaste@freebsd.org> wrote: >>=20 >> Author: emaste >> Date: Thu Jun 22 14:30:09 2017 >> New Revision: 320234 >> URL: https://svnweb.freebsd.org/changeset/base/320234 >>=20 >> Log: >> Make structure padding explicit in EFI_MEMORY_DESCRIPTOR >>=20 >> The EFI memory descriptor 64-bit aligns PhysicalStart on both 32- and >> 64-bit platforms. Make the padding explicit for i386 EFI. >>=20 >> Submitted by: Siva Mahadevan = <smahadevan@freebsdfoundation.org> >> MFC after: 3 weeks >> Sponsored by: The FreeBSD Foundation >> Differential Revision: https://reviews.freebsd.org/D11301 >>=20 >> Modified: >> head/sys/boot/efi/include/efidef.h >>=20 >> Modified: head/sys/boot/efi/include/efidef.h >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/sys/boot/efi/include/efidef.h Thu Jun 22 13:31:44 2017 = (r320233) >> +++ head/sys/boot/efi/include/efidef.h Thu Jun 22 14:30:09 2017 = (r320234) >> @@ -178,6 +178,7 @@ typedef enum { >> #define EFI_MEMORY_DESCRIPTOR_VERSION 1 >> typedef struct { >> UINT32 Type; // Field size is = 32 bits followed by 32 bit pad >> + UINT32 Pad; >> EFI_PHYSICAL_ADDRESS PhysicalStart; // Field size is = 64 bits >> EFI_VIRTUAL_ADDRESS VirtualStart; // Field size is = 64 bits >> UINT64 NumberOfPages; // Field size is = 64 bits >=20 > If you explicitly insert padding, it is better to mark the struct as > __packed, I think. Or at least also specify the alignment explicitly. >=20 > -Dimitry >=20 There is also second one with the same issue: in sys/boot/efi/include/efiprot.h @@ -90,12 +90,14 @@ typedef struct { BOOLEAN LogicalPartition; BOOLEAN ReadOnly; BOOLEAN WriteCaching; + UINT8 pad1[3]; =20 UINT32 BlockSize; UINT32 IoAlign; + UINT8 pad2[4]; =20 EFI_LBA LastBlock; -} EFI_BLOCK_IO_MEDIA; +} __packed EFI_BLOCK_IO_MEDIA; Without this, the EFI32 will get disk sizes wrong. rgds, toomas
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?62AB7B61-DE8C-4CBA-94EA-899A7564E751>