From mboxrd@z Thu Jan 1 00:00:00 1970 Subject: Re: [edk2-devel] [PATCH v4 2/5] UefiCpuPkg/SmmBaseHob.h: Add SMM Base HOB Data To: Ni, Ray ,devel@edk2.groups.io From: =?UTF-8?B?TWFydmluIEjDpHVzZXI=?= X-Originating-Location: US (172.226.110.19) X-Originating-Platform: iPhone Safari 16.3 User-Agent: GROUPS.IO Web Poster MIME-Version: 1.0 Date: Fri, 10 Feb 2023 00:47:29 -0800 References: In-Reply-To: Message-ID: <14845.1676018849905103136@groups.io> Content-Type: multipart/alternative; boundary="IgWTnMlSG4BEjHLekkXe" --IgWTnMlSG4BEjHLekkXe Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi Ray and Jiaxin, Quick reminder that [1] invokes undefined behaviour and [0] is not legal C,= but a compiler extension. The canonical way is a flexible array member usi= ng []. Off-topic and nitpicking, but I started wondering why so many structures ar= e packed. For UEFI, packing would only help saving RAM when there=E2=80=98s= actual padding (unlike this case, where there isn=E2=80=98t). All architec= tures require natural data alignment (=E2=80=9Eunless specifies otherwise= =E2=80=9C), so there should be no compatibility concerns for structures spe= cific to UEFI and UEFI PI ever. When considering ABIs outside UEFI, even th= en natural alignment is the strictest realistically possible outside super = niche platforms, as even executable formats don=E2=80=98t pack their struct= ures (this structure also is inherently naturally aligned). Best regards, Marvin --IgWTnMlSG4BEjHLekkXe Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi Ray and Jiaxin,

Quick reminder that [1] invokes undefined beh= aviour and [0] is not legal C, but a compiler extension. The canonical way = is a flexible array member using [].

Off-topic and nitpicking, b= ut I started wondering why so many structures are packed. For UEFI, packing= would only help saving RAM when there‘s actual padding (unlike this = case, where there isn‘t). All architectures require natural data alig= nment („unless specifies otherwise“), so there should be no com= patibility concerns for structures specific to UEFI and UEFI PI ever. When = considering ABIs outside UEFI, even then natural alignment is the strictest= realistically possible outside super niche platforms, as even executable f= ormats don‘t pack their structures (this structure also is inherently= naturally aligned).

Best regards,
Marvin --IgWTnMlSG4BEjHLekkXe--