From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.3049.1592345534853346507 for ; Tue, 16 Jun 2020 15:12:15 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ard.biesheuvel@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 64C3B1FB; Tue, 16 Jun 2020 15:12:14 -0700 (PDT) Received: from [192.168.1.69] (unknown [10.37.8.36]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B1ED63F71F; Tue, 16 Jun 2020 15:12:12 -0700 (PDT) Subject: Re: [edk2-devel] [PATCH v3] MdePkg/BasePrintLib: avoid absolute addresses for error strings To: Andrew Fish , edk2-devel-groups-io Cc: "Liu, Zhiguang" , Mike Kinney , "Gao, Liming" References: <20200611223509.344290-1-ard.biesheuvel@arm.com> <186092C8-F485-4696-A92B-1E02C43C6DA8@apple.com> From: "Ard Biesheuvel" Message-ID: Date: Wed, 17 Jun 2020 00:12:08 +0200 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <186092C8-F485-4696-A92B-1E02C43C6DA8@apple.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 6/16/20 11:12 PM, Andrew Fish wrote: > I was wondering what would happen if we converted the CHAR8 arrays in to= = =20 > strings with multiple nulls [1]. Looks like it saves space in=20 > uncompressed FVs, but not in compressed FVs. >=20 Yeah, those NUL bytes compress really well, so the overhead of the extra= =20 code you need to unpack your strings stands out in the compressed FV. > Here are the Xcode numbers for X64 DEBUG Ovmf: >=20 > With this Patch: > SECFV [14%Full] 212992 total, 30128 used, 182864 free > PEIFV [29%Full] 917504 total, 273192 used, 644312 free > DXEFV [39%Full] 12582912 total, 4997120 used, 7585792 free > FVMAIN_COMPACT [36%Full] 3440640 total, 1271264 used, 2169376 free >=20 > Vs my patch: > SECFV [14%Full] 212992 total,=C2=A029872=C2=A0used, 183120 free > PEIFV [29%Full] 917504 total, 271048 used, 646456 free > DXEFV [39%Full] 12582912 total, 4979552 used, 7603360 free > FVMAIN_COMPACT [36%Full] 3440640 total, 1271824 used, 2168816 free >=20 > SEC: -256 > PEI: -2,144 > Dxe: -17,568 > Compact: +560 >=20 > [1] $ git diff > *diff --git a/MdePkg/Library/BasePrintLib/PrintLibInternal.c=20 > b/MdePkg/Library/BasePrintLib/PrintLibInternal.c* > *index 50c6e8559c43..db2533e7affb 100644* > *--- a/MdePkg/Library/BasePrintLib/PrintLibInternal.c* > *+++ b/MdePkg/Library/BasePrintLib/PrintLibInternal.c* > @@ -30,53 +30,73 @@GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 mHexStr[] = =3D=20 > {'0','1','2','3','4','5',' > =C2=A0// > =C2=A0// Longest string: RETURN_WARN_BUFFER_TOO_SMALL =3D> 24 character= s plus=20 > NUL byte > =C2=A0// > -GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 mWarningString[][24+1] =3D { > -=C2=A0 "Success",=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 //=C2=A0 RETURN_SUCCESS=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D 0 > -=C2=A0 "Warning Unknown Glyph",=C2=A0 =C2=A0 =C2=A0 =C2=A0 //=C2=A0 RET= URN_WARN_UNKNOWN_GLYPH =C2=A0 =C2=A0 =3D 1 > -=C2=A0 "Warning Delete Failure", =C2=A0 =C2=A0 =C2=A0 //=C2=A0 RETURN_W= ARN_DELETE_FAILURE=C2=A0 =C2=A0 =3D 2 > -=C2=A0 "Warning Write Failure",=C2=A0 =C2=A0 =C2=A0 =C2=A0 //=C2=A0 RET= URN_WARN_WRITE_FAILURE =C2=A0 =C2=A0 =3D 3 > -=C2=A0 "Warning Buffer Too Small", =C2=A0 =C2=A0 //=C2=A0 RETURN_WARN_B= UFFER_TOO_SMALL=C2=A0 =3D 4 > -=C2=A0 "Warning Stale Data", =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 //=C2= =A0 RETURN_WARN_STALE_DATA=C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D 5 > -}; > +GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 *mWarningString =3D = =20 > =C2=A0 =C2=A0 \ > +=C2=A0 "Success\0"=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 /*=C2=A0 RETURN_SUCCESS=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D=20 > 0 */ \ > +=C2=A0 "Warning Unknown Glyph\0"=C2=A0 =C2=A0 =C2=A0 =C2=A0 /*=C2=A0 RE= TURN_WARN_UNKNOWN_GLYPH =C2=A0 =C2=A0 =3D=20 > 1 */ \ > +=C2=A0 "Warning Delete Failure\0" =C2=A0 =C2=A0 =C2=A0 /*=C2=A0 RETURN_= WARN_DELETE_FAILURE=C2=A0 =C2=A0 =3D=20 > 2 */ \ > +=C2=A0 "Warning Write Failure\0"=C2=A0 =C2=A0 =C2=A0 =C2=A0 /*=C2=A0 RE= TURN_WARN_WRITE_FAILURE =C2=A0 =C2=A0 =3D=20 > 3 */ \ > +=C2=A0 "Warning Buffer Too Small\0" =C2=A0 =C2=A0 /*=C2=A0 RETURN_WARN_= BUFFER_TOO_SMALL=C2=A0 =3D=20 > 4 */ \ > +=C2=A0 "Warning Stale Data";=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /= *=C2=A0 RETURN_WARN_STALE_DATA=C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D 5 */ >=20 >=20 > =C2=A0// > =C2=A0// Longest string: RETURN_INCOMPATIBLE_VERSION =3D> 20 characters= plus=20 > NUL byte > =C2=A0// > -GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 mErrorString[][20+1] =3D { > -=C2=A0 "Load Error", =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 //=C2=A0 RETURN_LOAD_ERROR =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =3D=20 > 1=C2=A0 | MAX_BIT > -=C2=A0 "Invalid Parameter",=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 //= = =C2=A0 RETURN_INVALID_PARAMETER=C2=A0 =C2=A0 =C2=A0 =3D=20 > 2=C2=A0 | MAX_BIT > -=C2=A0 "Unsupported",=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 //=C2=A0 RETURN_UNSUPPORTED=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =3D=20 > 3=C2=A0 | MAX_BIT > -=C2=A0 "Bad Buffer Size",=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 //=C2=A0 RETURN_BAD_BUFFER_SIZE=C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D=20 > 4=C2=A0 | MAX_BIT > -=C2=A0 "Buffer Too Small", =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 //= = =C2=A0 RETURN_BUFFER_TOO_SMALL,=C2=A0 =C2=A0 =C2=A0 =3D=20 > 5=C2=A0 | MAX_BIT > -=C2=A0 "Not Ready",=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= = =A0 =C2=A0 =C2=A0 //=C2=A0 RETURN_NOT_READY=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= = =A0 =C2=A0 =C2=A0 =3D=20 > 6=C2=A0 | MAX_BIT > -=C2=A0 "Device Error", =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 //=C2=A0 RETURN_DEVICE_ERROR =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D= = =20 > 7=C2=A0 | MAX_BIT > -=C2=A0 "Write Protected",=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 //=C2=A0 RETURN_WRITE_PROTECTED=C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D=20 > 8=C2=A0 | MAX_BIT > -=C2=A0 "Out of Resources", =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 //= = =C2=A0 RETURN_OUT_OF_RESOURCES =C2=A0 =C2=A0 =C2=A0 =3D=20 > 9=C2=A0 | MAX_BIT > -=C2=A0 "Volume Corrupt", =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 //=C2=A0 RETURN_VOLUME_CORRUPTED =C2=A0 =C2=A0 =C2=A0 =3D=20 > 10 | MAX_BIT > -=C2=A0 "Volume Full",=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 //=C2=A0 RETURN_VOLUME_FULL=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =3D=20 > 11 | MAX_BIT > -=C2=A0 "No Media", =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= = =A0 =C2=A0 =C2=A0 //=C2=A0 RETURN_NO_MEDIA =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= = =A0 =C2=A0 =C2=A0 =3D=20 > 12 | MAX_BIT > -=C2=A0 "Media changed",=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 //=C2=A0 RETURN_MEDIA_CHANGED=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D= = =20 > 13 | MAX_BIT > -=C2=A0 "Not Found",=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= = =A0 =C2=A0 =C2=A0 //=C2=A0 RETURN_NOT_FOUND=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= = =A0 =C2=A0 =C2=A0 =3D=20 > 14 | MAX_BIT > -=C2=A0 "Access Denied",=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 //=C2=A0 RETURN_ACCESS_DENIED=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D= = =20 > 15 | MAX_BIT > -=C2=A0 "No Response",=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 //=C2=A0 RETURN_NO_RESPONSE=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =3D=20 > 16 | MAX_BIT > -=C2=A0 "No mapping", =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 //=C2=A0 RETURN_NO_MAPPING =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =3D=20 > 17 | MAX_BIT > -=C2=A0 "Time out", =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= = =A0 =C2=A0 =C2=A0 //=C2=A0 RETURN_TIMEOUT=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =3D=20 > 18 | MAX_BIT > -=C2=A0 "Not started",=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 //=C2=A0 RETURN_NOT_STARTED=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =3D=20 > 19 | MAX_BIT > -=C2=A0 "Already started",=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 //=C2=A0 RETURN_ALREADY_STARTED=C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D=20 > 20 | MAX_BIT > -=C2=A0 "Aborted",=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 //=C2=A0 RETURN_ABORTED=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D=20 > 21 | MAX_BIT > -=C2=A0 "ICMP Error", =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 //=C2=A0 RETURN_ICMP_ERROR =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =3D=20 > 22 | MAX_BIT > -=C2=A0 "TFTP Error", =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 //=C2=A0 RETURN_TFTP_ERROR =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =3D=20 > 23 | MAX_BIT > -=C2=A0 "Protocol Error", =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 //=C2=A0 RETURN_PROTOCOL_ERROR =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D=20 > 24 | MAX_BIT > -=C2=A0 "Incompatible Version", =C2=A0 =C2=A0 =C2=A0 =C2=A0 //=C2=A0 RET= URN_INCOMPATIBLE_VERSION =C2=A0 =3D=20 > 25 | MAX_BIT > -=C2=A0 "Security Violation", =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 //=C2= =A0 RETURN_SECURITY_VIOLATION =C2=A0 =C2=A0 =3D=20 > 26 | MAX_BIT > -=C2=A0 "CRC Error",=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= = =A0 =C2=A0 =C2=A0 //=C2=A0 RETURN_CRC_ERROR=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= = =A0 =C2=A0 =C2=A0 =3D=20 > 27 | MAX_BIT > -=C2=A0 "End of Media", =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 //=C2=A0 RETURN_END_OF_MEDIA =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D= = =20 > 28 | MAX_BIT > -=C2=A0 "Reserved (29)",=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 //=C2=A0 RESERVED=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D=20 > 29 | MAX_BIT > -=C2=A0 "Reserved (30)",=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 //=C2=A0 RESERVED=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D=20 > 30 | MAX_BIT > -=C2=A0 "End of File",=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 //=C2=A0 RETURN_END_OF_FILE=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =3D=20 > 31 | MAX_BIT > -=C2=A0 "Invalid Language", =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 //= = =C2=A0 RETURN_INVALID_LANGUAGE =C2=A0 =C2=A0 =C2=A0 =3D=20 > 32 | MAX_BIT > -=C2=A0 "Compromised Data"=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 //=C2=A0 RETURN_COMPROMISED_DATA =C2=A0 =C2=A0 =C2=A0 =3D=20 > 33 | MAX_BIT > -}; > +GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 *mErrorString =3D = > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ > +=C2=A0 "Load Error\0" =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = = =C2=A0 =C2=A0 /*=C2=A0 RETURN_LOAD_ERROR =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =3D=20 > 1=C2=A0 | MAX_BIT */ \ > +=C2=A0 "Invalid Parameter\0"=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /= *=C2=A0 RETURN_INVALID_PARAMETER=C2=A0 =C2=A0 =C2=A0 =3D=20 > 2=C2=A0 | MAX_BIT */ \ > +=C2=A0 "Unsupported\0"=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = = =C2=A0 =C2=A0 /*=C2=A0 RETURN_UNSUPPORTED=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =3D=20 > 3=C2=A0 | MAX_BIT */ \ > +=C2=A0 "Bad Buffer Size\0"=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= = =A0 /*=C2=A0 RETURN_BAD_BUFFER_SIZE=C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D=20 > 4=C2=A0 | MAX_BIT */ \ > +=C2=A0 "Buffer Too Small\0" =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /= *=C2=A0 RETURN_BUFFER_TOO_SMALL,=C2=A0 =C2=A0 =C2=A0 =3D=20 > 5=C2=A0 | MAX_BIT */ \ > +=C2=A0 "Not Ready\0"=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 /*=C2=A0 RETURN_NOT_READY=C2=A0 =C2=A0 =C2=A0 =C2=A0 = = =C2=A0 =C2=A0 =C2=A0 =3D=20 > 6=C2=A0 | MAX_BIT */ \ > +=C2=A0 "Device Error\0" =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 /*=C2=A0 RETURN_DEVICE_ERROR =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =3D=20 > 7=C2=A0 | MAX_BIT */ \ > +=C2=A0 "Write Protected\0"=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= = =A0 /*=C2=A0 RETURN_WRITE_PROTECTED=C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D=20 > 8=C2=A0 | MAX_BIT */ \ > +=C2=A0 "Out of Resources\0" =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /= *=C2=A0 RETURN_OUT_OF_RESOURCES =C2=A0 =C2=A0 =C2=A0 =3D=20 > 9=C2=A0 | MAX_BIT */ \ > +=C2=A0 "Volume Corrupt\0" =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= = =A0 /*=C2=A0 RETURN_VOLUME_CORRUPTED =C2=A0 =C2=A0 =C2=A0 =3D=20 > 10 | MAX_BIT */ \ > +=C2=A0 "Volume Full\0"=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = = =C2=A0 =C2=A0 /*=C2=A0 RETURN_VOLUME_FULL=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =3D=20 > 11 | MAX_BIT */ \ > +=C2=A0 "No Media\0" =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 /*=C2=A0 RETURN_NO_MEDIA =C2=A0 =C2=A0 =C2=A0 =C2=A0 = = =C2=A0 =C2=A0 =C2=A0 =3D=20 > 12 | MAX_BIT */ \ > +=C2=A0 "Media changed\0"=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 /*=C2=A0 RETURN_MEDIA_CHANGED=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =3D=20 > 13 | MAX_BIT */ \ > +=C2=A0 "Not Found\0"=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 /*=C2=A0 RETURN_NOT_FOUND=C2=A0 =C2=A0 =C2=A0 =C2=A0 = = =C2=A0 =C2=A0 =C2=A0 =3D=20 > 14 | MAX_BIT */ \ > +=C2=A0 "Access Denied\0"=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 /*=C2=A0 RETURN_ACCESS_DENIED=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =3D=20 > 15 | MAX_BIT */ \ > +=C2=A0 "No Response\0"=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = = =C2=A0 =C2=A0 /*=C2=A0 RETURN_NO_RESPONSE=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =3D=20 > 16 | MAX_BIT */ \ > +=C2=A0 "No mapping\0" =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = = =C2=A0 =C2=A0 /*=C2=A0 RETURN_NO_MAPPING =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =3D=20 > 17 | MAX_BIT */ \ > +=C2=A0 "Time out\0" =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 /*=C2=A0 RETURN_TIMEOUT=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D=20 > 18 | MAX_BIT */ \ > +=C2=A0 "Not started\0"=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = = =C2=A0 =C2=A0 /*=C2=A0 RETURN_NOT_STARTED=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =3D=20 > 19 | MAX_BIT */ \ > +=C2=A0 "Already started\0"=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= = =A0 /*=C2=A0 RETURN_ALREADY_STARTED=C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D=20 > 20 | MAX_BIT */ \ > +=C2=A0 "Aborted\0"=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 /*=C2=A0 RETURN_ABORTED=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D=20 > 21 | MAX_BIT */ \ > +=C2=A0 "ICMP Error\0" =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = = =C2=A0 =C2=A0 /*=C2=A0 RETURN_ICMP_ERROR =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =3D=20 > 22 | MAX_BIT */ \ > +=C2=A0 "TFTP Error\0" =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = = =C2=A0 =C2=A0 /*=C2=A0 RETURN_TFTP_ERROR =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =3D=20 > 23 | MAX_BIT */ \ > +=C2=A0 "Protocol Error\0" =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= = =A0 /*=C2=A0 RETURN_PROTOCOL_ERROR =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D=20 > 24 | MAX_BIT */ \ > +=C2=A0 "Incompatible Version\0" =C2=A0 =C2=A0 =C2=A0 =C2=A0 /*=C2=A0 RE= TURN_INCOMPATIBLE_VERSION =C2=A0 =3D=20 > 25 | MAX_BIT */ \ > +=C2=A0 "Security Violation\0" =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /*=C2= =A0 RETURN_SECURITY_VIOLATION =C2=A0 =C2=A0 =3D=20 > 26 | MAX_BIT */ \ > +=C2=A0 "CRC Error\0"=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 /*=C2=A0 RETURN_CRC_ERROR=C2=A0 =C2=A0 =C2=A0 =C2=A0 = = =C2=A0 =C2=A0 =C2=A0 =3D=20 > 27 | MAX_BIT */ \ > +=C2=A0 "End of Media\0" =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 /*=C2=A0 RETURN_END_OF_MEDIA =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =3D=20 > 28 | MAX_BIT */ \ > +=C2=A0 "Reserved (29)\0"=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 /*=C2=A0 RESERVED=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D=20 > 29 | MAX_BIT */ \ > +=C2=A0 "Reserved (30)\0"=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 /*=C2=A0 RESERVED=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D=20 > 30 | MAX_BIT */ \ > +=C2=A0 "End of File\0"=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = = =C2=A0 =C2=A0 /*=C2=A0 RETURN_END_OF_FILE=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =3D=20 > 31 | MAX_BIT */ \ > +=C2=A0 "Invalid Language\0" =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /= *=C2=A0 RETURN_INVALID_LANGUAGE =C2=A0 =C2=A0 =C2=A0 =3D=20 > 32 | MAX_BIT */ \ > +=C2=A0 "Compromised Data";=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= = =A0 /*=C2=A0 RETURN_COMPROMISED_DATA =C2=A0 =C2=A0 =C2=A0 =3D=20 > 33 | MAX_BIT */ > + > + > +CONST CHAR8 * > +FindNthStr ( > +=C2=A0 IN CONST CHAR8 *Start, > +=C2=A0 IN UINTN =C2=A0 =C2=A0 =C2=A0 Index > +=C2=A0 ) > +{ > +=C2=A0 CONST CHAR8 *str; > + > +=C2=A0 for (str =3D Start; Index > 0; str++) { > +=C2=A0 =C2=A0 if (*str =3D=3D '\0') { > +=C2=A0 =C2=A0 =C2=A0 Index--; > +=C2=A0 =C2=A0 =C2=A0 if (Index =3D=3D 0) { > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 str++; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 break; > +=C2=A0 =C2=A0 =C2=A0 } > +=C2=A0 =C2=A0 } > +=C2=A0 } > + > +=C2=A0 return str; > +} >=20 >=20 >=20 > =C2=A0/** > @@ -1005,12 +1025,12 @@BasePrintLibSPrintMarker ( > =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 // > =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Index =3D Status & ~MAX_BIT; > =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (Index > 0 && Index <=3D ER= ROR_STATUS_NUMBER) { > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ArgumentString =3D mErrorStri= ng [Index - 1]; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ArgumentString =3D FindNthStr= (mErrorString, Index - 1); > =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } > =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 } else { > =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Index =3D Status; > =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (Index <=3D WARNING_STATUS_= NUMBER) { > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ArgumentString =3D mWarningSt= ring [Index]; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ArgumentString =3D FindNthStr= (mWarningString, Index); > =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } > =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 } > =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (ArgumentString =3D=3D ValueBuffer= ) { >=20 > Thanks, >=20 > Andrew Fish >=20 >> On Jun 15, 2020, at 6:57 PM, Liming Gao > > wrote: >> >> This data is great. The change is good. Reviewed-by: Liming Gao=20 >> > >> *From:*Liu, Zhiguang > > >> *Sent:*2020=E5=B9=B46=E6=9C=8815=E6=97=A515:34 >> *To:*Ard Biesheuvel > >; Gao, Liming > >;devel@edk2.groups.io=20 >> >> *Cc:*Kinney, Michael D > > >> *Subject:*RE: [edk2-devel] [PATCH v3] MdePkg/BasePrintLib: avoid=20 >> absolute addresses for error strings >> Hi Ard, >> I also collected the image size of OVMFX64 size building with VS2015x86= . >> =09 >> Debug >> =09 >> Release >> =09 >> before >> =09 >> after >> =09 >> After-before >> =09 >> before >> =09 >> after >> =09 >> after-before >> sec >> =09 >> 27664 >> =09 >> 27409 >> =09 >> -255 >> =09 >> 13968 >> =09 >> 13968 >> =09 >> 0 >> pei >> =09 >> 223016 >> =09 >> 221000 >> =09 >> -2016 >> =09 >> 107208 >> =09 >> 106984 >> =09 >> -224 >> dxe >> =09 >> 4507000 >> =09 >> 4481336 >> =09 >> -25664 >> =09 >> 2987064 >> =09 >> 2979384 >> =09 >> -7680 >> compact >> =09 >> 1179776 >> =09 >> 1172528 >> =09 >> -7248 >> =09 >> 922664 >> =09 >> 920304 >> =09 >> -2360 >> >> It can reduce the image size in X64. >> Reviewed-by: Zhiguang Liu > > >> > -----Original Message----- >> > From: Ard Biesheuvel > >> > Sent: Friday, June 12, 2020 11:11 PM >> > To: Gao, Liming > >;devel@edk2.groups.io=20 >> >> > Cc: Kinney, Michael D >; Liu,=20 >> Zhiguang >> > > >> > Subject: Re: [edk2-devel] [PATCH v3] MdePkg/BasePrintLib: avoid absol= ute >> > addresses for error strings >> > >> > On 6/12/20 4:33 PM, Gao, Liming wrote: >> > > Ard: >> > >=C2=A0=C2=A0=C2=A0 I will collect the image size on OVMF X64 platfor= m with this patch. >> > > >> > >> > Building OvmfPkgX64.dsc in RELEASE mode using GCC5 profile gives me >> > >> > >> > Before: >> > SECFV [5%Full] 212992 total, 11760 used, 201232 free PEIFV [9%Full] 9= 17504 >> > total, 89384 used, 828120 free DXEFV [22%Full] 12582912 total, 280632= 0 used, >> > 9776592 free FVMAIN_COMPACT [26%Full] 3440640 total, 918760 used, >> > 2521880 free >> > >> > After: >> > SECFV [5%Full] 212992 total, 11760 used, 201232 free PEIFV [9%Full] 9= 17504 >> > total, 89192 used, 828312 free DXEFV [22%Full] 12582912 total, 280292= 8 used, >> > 9779984 free FVMAIN_COMPACT [26%Full] 3440640 total, 916784 used, >> > 2523856 free >> > >> > So no change for SECFV, -192 bytes for PEIFV, -3392 bytes for DXEFV a= nd >> > -1976 bytes for the resulting outer FV image. >> > >> > >> > >> > >> -----Original Message----- >> > >> From:devel@edk2.groups.io=20 >> > > On Behalf Of Ard >> > Biesheuvel >> > >> Sent: Friday, June 12, 2020 6:35 AM >> > >> To:devel@edk2.groups.io >> > >> Cc: Ard Biesheuvel >; Kinney, Michael D >> > >; Gao= ,=20 >> Liming > >> > >> Subject: [edk2-devel] [PATCH v3] MdePkg/BasePrintLib: avoid absolu= te >> > addresses for error strings >> > >> >> > >> The mStatusString[] array is constructed as an array of pointer-to= -char, >> > >> which means that on X64 or AARCH64, it is emitted as a single line= ar list >> > >> of 64-bit quantities, each containing the absolute address of one = of the >> > >> string literals in memory. >> > >> >> > >> This means that each string takes up 8 bytes of additional space, = along >> > >> with 2 bytes of relocation data. It also means that extra work nee= ds to >> > >> be done at runtime to process these relocations, every time a modu= le is >> > >> loaded that incorporates this library. >> > >> >> > >> So fix both issues, by splitting mStatusString into two arrays of = char >> > >> arrays. The memory footprint decreases from 955 to 843 bytes, and = given >> > >> that in the latter case, the overhead consists of 278 NUL characte= rs rather >> > >> than 390 bytes worth of absolute addresses and relocation records,= the >> > size >> > >> of a compressed image is reduced even further. For example, when >> > building >> > >> ArmVirtQemu.dsc in RELEASE mode for AARCH64 with the GCC5 profile,= I >> > get: >> > >> >> > >>=C2=A0=C2=A0=C2=A0 Before >> > >> >> > >>=C2=A0 =C2=A0=C2=A0FV Space Information >> > >>=C2=A0=C2=A0=C2=A0 FVMAIN [100%Full] 5329920 total, 5329920 used, 0= free >> > >>=C2=A0=C2=A0=C2=A0 FVMAIN_COMPACT [38%Full] 2093056 total, 811840 u= sed, 1281216 free >> > >> >> > >>=C2=A0=C2=A0=C2=A0 After >> > >> >> > >>=C2=A0=C2=A0=C2=A0 FV Space Information >> > >>=C2=A0=C2=A0=C2=A0 FVMAIN [100%Full] 5321728 total, 5321728 used, 0= free >> > >>=C2=A0=C2=A0=C2=A0 FVMAIN_COMPACT [38%Full] 2093056 total, 809696 u= sed, 1283360 free >> > >> >> > >> So the uncompressed contents of the compressed image are 8 KB smal= ler, >> > >> whereas the resulting flash image (consisting of the compressed im= age >> > >> along with SEC, PEI_CORE and a set of PEIMs that execute in place)= is >> > >> 2 KB smaller. >> > >> >> > >> Cc: "Kinney, Michael D" > >> > >> Cc: "Gao, Liming" > >> > >> Signed-off-by: Ard Biesheuvel > >> > >> --- >> > >> v3: >> > >> - add code comments to explain what the inner dimension of each ar= ray is >> > >>=C2=A0=C2=A0=C2=A0 based on >> > >> >> > >> v2: >> > >> - split off this patch from the StandaloneMmPkg series, since they= are not >> > >>=C2=A0=C2=A0=C2=A0 interdependent anyway, and so they can be discus= sed separately >> > >> - remove mention of StandaloneMmPkg from the commit log - the spac= e >> > savings >> > >>=C2=A0=C2=A0=C2=A0 by themselves are sufficient justification >> > >> - update the before/after numbers with the current results >> > >> - split the warnings and errors into a separate array, so that the= latter >> > >>=C2=A0=C2=A0=C2=A0 can use smaller entries >> > >> - clarify the commit log to explain the effect on compressed as we= ll as >> > >>=C2=A0=C2=A0=C2=A0 XIP images (which both get smaller) >> > >> >> > >>=C2=A0=C2=A0 MdePkg/Library/BasePrintLib/PrintLibInternal.c | 15 ++= ++++++++++--- >> > >>=C2=A0=C2=A0 1 file changed, 12 insertions(+), 3 deletions(-) >> > >> >> > >> diff --git a/MdePkg/Library/BasePrintLib/PrintLibInternal.c >> > b/MdePkg/Library/BasePrintLib/PrintLibInternal.c >> > >> index b6ec5ac4fbb9..50c6e8559c43 100644 >> > >> --- a/MdePkg/Library/BasePrintLib/PrintLibInternal.c >> > >> +++ b/MdePkg/Library/BasePrintLib/PrintLibInternal.c >> > >> @@ -27,13 +27,22 @@ >> > >> >> > >> >> > >>=C2=A0=C2=A0 GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 mHexStr[] = =3D >> > {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; >> > >> >> > >> >> > >> >> > >> -GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 * CONST >> > mStatusString[] =3D { >> > >> >> > >> +// >> > >> >> > >> +// Longest string: RETURN_WARN_BUFFER_TOO_SMALL =3D> 24 >> > characters plus NUL byte >> > >> >> > >> +// >> > >> >> > >> +GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 >> > mWarningString[][24+1] =3D { >> > >> >> > >>=C2=A0=C2=A0=C2=A0=C2=A0 "Success",=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 //=C2=A0 RETURN_SUCCESS=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D 0 >> > >> >> > >>=C2=A0 =C2=A0=C2=A0=C2=A0"Warning Unknown Glyph",=C2=A0=C2=A0=C2=A0= = =C2=A0=C2=A0=C2=A0=C2=A0 //=C2=A0 RETURN_WARN_UNKNOWN_GLYPH >> > =3D 1 >> > >> >> > >>=C2=A0=C2=A0=C2=A0=C2=A0 "Warning Delete Failure",=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 //=C2=A0 RETURN_WARN_DELETE_FAILURE=C2=A0=C2=A0=C2= =A0 =3D 2 >> > >> >> > >>=C2=A0=C2=A0=C2=A0=C2=A0 "Warning Write Failure",=C2=A0=C2=A0=C2=A0= = =C2=A0=C2=A0=C2=A0=C2=A0 //=C2=A0 RETURN_WARN_WRITE_FAILURE=C2=A0=C2=A0=C2= = =A0=C2=A0 =3D 3 >> > >> >> > >>=C2=A0=C2=A0=C2=A0=C2=A0 "Warning Buffer Too Small",=C2=A0=C2=A0=C2= = =A0=C2=A0 // >> > RETURN_WARN_BUFFER_TOO_SMALL=C2=A0 =3D 4 >> > >> >> > >>=C2=A0=C2=A0=C2=A0=C2=A0 "Warning Stale Data",=C2=A0=C2=A0=C2=A0=C2= = =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 //=C2=A0 RETURN_WARN_STALE_DATA=C2= = =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D 5 >> > >> >> > >> +}; >> > >> >> > >> + >> > >> >> > >> +// >> > >> >> > >> +// Longest string: RETURN_INCOMPATIBLE_VERSION =3D> 20 characters >> > plus NUL byte >> > >> >> > >> +// >> > >> >> > >> +GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 >> > mErrorString[][20+1] =3D { >> > >> >> > >>=C2=A0=C2=A0=C2=A0=C2=A0 "Load Error",=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 //=C2=A0 RETURN_LOAD_ERROR=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D 1=C2=A0 | MAX_BIT >> > >> >> > >>=C2=A0=C2=A0=C2=A0=C2=A0 "Invalid Parameter",=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 //=C2=A0 RETURN_INVALID_PARA= METER=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D 2=C2=A0 | >> > MAX_BIT >> > >> >> > >>=C2=A0=C2=A0=C2=A0=C2=A0 "Unsupported",=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 //=C2=A0 RETURN_UNSUPPORTED=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 =3D 3=C2=A0 | >> > MAX_BIT >> > >> >> > >> @@ -996,12 +1005,12 @@ BasePrintLibSPrintMarker ( >> > >>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 // >> > >> >> > >>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 Index =3D Status & ~MAX_BIT; >> > >> >> > >>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 if (Index > 0 && Index <=3D ERROR_STATUS_NUMBER) { >> > >> >> > >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 ArgumentString =3D mStatusString [Index + >> > WARNING_STATUS_NUMBER]; >> > >> >> > >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 ArgumentString =3D mErrorString [Index - 1]; >> > >> >> > >>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 } >> > >> >> > >>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } else= { >> > >> >> > >>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 Index =3D Status; >> > >> >> > >>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 if (Index <=3D WARNING_STATUS_NUMBER) { >> > >> >> > >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 ArgumentString =3D mStatusString [Index]; >> > >> >> > >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 ArgumentString =3D mWarningString [Index]; >> > >> >> > >>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 } >> > >> >> > >>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } >> > >> >> > >>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (Ar= gumentString =3D=3D ValueBuffer) { >> > >> >> > >> -- >> > >> 2.26.2 >> > >> >> > >> >> > >> -=3D-=3D-=3D-=3D-=3D-=3D >> > >>Groups.io Links: You receive all messages sent t= o=20 >> this group. >> > >> >> > >> View/Reply Online (#61170): >> >https://edk2.groups.io/g/devel/message/61170 >> > >> Mute This Topic:https://groups.io/mt/74829004/1759384 >> > >> Group Owner:devel+owner@edk2.groups.io >> > >> Unsubscribe:https://edk2.groups.io/g/devel/unsub >> > [liming.gao@intel.com ] >> > >> -=3D-=3D-=3D-=3D-=3D-=3D >> > > >>=20 >=20