From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from ma1-aaemail-dr-lapp02.apple.com (ma1-aaemail-dr-lapp02.apple.com [17.171.2.68]) by mx.groups.io with SMTP id smtpd.web10.1892.1592341963806596984 for ; Tue, 16 Jun 2020 14:12:45 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@apple.com header.s=20180706 header.b=qbkSVSUd; spf=pass (domain: apple.com, ip: 17.171.2.68, mailfrom: afish@apple.com) Received: from pps.filterd (ma1-aaemail-dr-lapp02.apple.com [127.0.0.1]) by ma1-aaemail-dr-lapp02.apple.com (8.16.0.42/8.16.0.42) with SMTP id 05GKnnhh030105; Tue, 16 Jun 2020 14:12:40 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apple.com; h=from : message-id : content-type : mime-version : subject : date : in-reply-to : cc : to : references; s=20180706; bh=LfF8Qjgs5Q03LD3s7sflRZDr1yWyRPTDexTXNaSGE2o=; b=qbkSVSUd4S0rwy7tmQfBrpEplPtJM9fiJW3DhP+4MqF4Nx6POEmPJBwNLzC38mfHraeY qBz9OewJGNBSgtM6sfGhgYMyaDLKELmMZZL7UptwnwlJlR9aS2YEkGs7rU0o1ZXsk7oX wVx3ZDWz2QdlwKZQ5Fn8zGULC1c6m9hWC4XiqgYrxAdK9D/r1Va0rz2lSZkusZBXOcNw kfxuaYacbB9lhStb2dodxW5x95Z7Se/KWdMu3j4ajCExRde5O/2g75hMjDc5M0n+Zon1 Jc68mP1mjUBQunDaEqzv/HtpL6dlur17IRjxUQxl5E3qWl+ywglzf4/DCFWNpXVz0F5F MQ== Received: from rn-mailsvcp-mta-lapp02.rno.apple.com (rn-mailsvcp-mta-lapp02.rno.apple.com [10.225.203.150]) by ma1-aaemail-dr-lapp02.apple.com with ESMTP id 31pv5bseh0-11 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Tue, 16 Jun 2020 14:12:40 -0700 Received: from rn-mailsvcp-mmp-lapp03.rno.apple.com (rn-mailsvcp-mmp-lapp03.rno.apple.com [17.179.253.16]) by rn-mailsvcp-mta-lapp02.rno.apple.com (Oracle Communications Messaging Server 8.1.0.5.20200312 64bit (built Mar 12 2020)) with ESMTPS id <0QC100IE8EX2QHK0@rn-mailsvcp-mta-lapp02.rno.apple.com>; Tue, 16 Jun 2020 14:12:39 -0700 (PDT) Received: from process_milters-daemon.rn-mailsvcp-mmp-lapp03.rno.apple.com by rn-mailsvcp-mmp-lapp03.rno.apple.com (Oracle Communications Messaging Server 8.1.0.5.20200312 64bit (built Mar 12 2020)) id <0QC100900EFJ3K00@rn-mailsvcp-mmp-lapp03.rno.apple.com>; Tue, 16 Jun 2020 14:12:38 -0700 (PDT) X-Va-A: X-Va-T-CD: e0acb9dc03d22e4581b62f3d752335f3 X-Va-E-CD: 1bd497ceb6732cb49eb0eedf1a1fe4a1 X-Va-R-CD: f4fc29317e8230b4d38db50a6737e699 X-Va-CD: 0 X-Va-ID: 6268afbc-e19c-4eda-bfb0-ab1fbfcbd101 X-V-A: X-V-T-CD: e0acb9dc03d22e4581b62f3d752335f3 X-V-E-CD: 1bd497ceb6732cb49eb0eedf1a1fe4a1 X-V-R-CD: f4fc29317e8230b4d38db50a6737e699 X-V-CD: 0 X-V-ID: 612d148f-0f40-4e90-a019-ba4b21344ad8 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216,18.0.687 definitions=2020-06-16_13:2020-06-16,2020-06-16 signatures=0 Received: from [17.235.26.53] (unknown [17.235.26.53]) by rn-mailsvcp-mmp-lapp03.rno.apple.com (Oracle Communications Messaging Server 8.1.0.5.20200312 64bit (built Mar 12 2020)) with ESMTPSA id <0QC100ZNTEX1PD00@rn-mailsvcp-mmp-lapp03.rno.apple.com>; Tue, 16 Jun 2020 14:12:38 -0700 (PDT) From: "Andrew Fish" Message-id: <186092C8-F485-4696-A92B-1E02C43C6DA8@apple.com> MIME-version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: [edk2-devel] [PATCH v3] MdePkg/BasePrintLib: avoid absolute addresses for error strings Date: Tue, 16 Jun 2020 14:12:36 -0700 In-reply-to: Cc: "Liu, Zhiguang" , Mike Kinney , "Gao, Liming" To: edk2-devel-groups-io , Ard Biesheuvel References: <20200611223509.344290-1-ard.biesheuvel@arm.com> X-Mailer: Apple Mail (2.3608.80.23.2.2) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216,18.0.687 definitions=2020-06-16_13:2020-06-16,2020-06-16 signatures=0 Content-type: multipart/alternative; boundary="Apple-Mail=_EBC707D1-F0F8-473D-949A-DEEC2794F2F7" --Apple-Mail=_EBC707D1-F0F8-473D-949A-DEEC2794F2F7 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 I was wondering what would happen if we converted the CHAR8 arrays in to st= rings with multiple nulls [1]. Looks like it saves space in uncompressed FV= s, but not in compressed FVs. Here are the Xcode numbers for X64 DEBUG Ovmf: 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 Vs my patch: SECFV [14%Full] 212992 total, 29872 used, 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 SEC: -256 PEI: -2,144 Dxe: -17,568 Compact: +560 [1] $ git diff diff --git a/MdePkg/Library/BasePrintLib/PrintLibInternal.c b/MdePkg/Libra= ry/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 {'0','1','2','3','4','5',' // // Longest string: RETURN_WARN_BUFFER_TOO_SMALL =3D> 24 characters plus N= UL byte // -GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 mWarningString[][24+1] =3D { - "Success", // RETURN_SUCCESS =3D 0 - "Warning Unknown Glyph", // RETURN_WARN_UNKNOWN_GLYPH =3D 1 - "Warning Delete Failure", // RETURN_WARN_DELETE_FAILURE =3D 2 - "Warning Write Failure", // RETURN_WARN_WRITE_FAILURE =3D 3 - "Warning Buffer Too Small", // RETURN_WARN_BUFFER_TOO_SMALL =3D 4 - "Warning Stale Data", // RETURN_WARN_STALE_DATA =3D 5 -}; +GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 *mWarningString =3D = \ + "Success\0" /* RETURN_SUCCESS =3D = 0 */ \ + "Warning Unknown Glyph\0" /* RETURN_WARN_UNKNOWN_GLYPH =3D = 1 */ \ + "Warning Delete Failure\0" /* RETURN_WARN_DELETE_FAILURE =3D = 2 */ \ + "Warning Write Failure\0" /* RETURN_WARN_WRITE_FAILURE =3D = 3 */ \ + "Warning Buffer Too Small\0" /* RETURN_WARN_BUFFER_TOO_SMALL =3D = 4 */ \ + "Warning Stale Data"; /* RETURN_WARN_STALE_DATA =3D = 5 */ =20 // // Longest string: RETURN_INCOMPATIBLE_VERSION =3D> 20 characters plus NU= L byte // -GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 mErrorString[][20+1] =3D { - "Load Error", // RETURN_LOAD_ERROR =3D 1= | MAX_BIT - "Invalid Parameter", // RETURN_INVALID_PARAMETER =3D 2= | MAX_BIT - "Unsupported", // RETURN_UNSUPPORTED =3D 3= | MAX_BIT - "Bad Buffer Size", // RETURN_BAD_BUFFER_SIZE =3D 4= | MAX_BIT - "Buffer Too Small", // RETURN_BUFFER_TOO_SMALL, =3D 5= | MAX_BIT - "Not Ready", // RETURN_NOT_READY =3D 6= | MAX_BIT - "Device Error", // RETURN_DEVICE_ERROR =3D 7= | MAX_BIT - "Write Protected", // RETURN_WRITE_PROTECTED =3D 8= | MAX_BIT - "Out of Resources", // RETURN_OUT_OF_RESOURCES =3D 9= | MAX_BIT - "Volume Corrupt", // RETURN_VOLUME_CORRUPTED =3D 1= 0 | MAX_BIT - "Volume Full", // RETURN_VOLUME_FULL =3D 1= 1 | MAX_BIT - "No Media", // RETURN_NO_MEDIA =3D 1= 2 | MAX_BIT - "Media changed", // RETURN_MEDIA_CHANGED =3D 1= 3 | MAX_BIT - "Not Found", // RETURN_NOT_FOUND =3D 1= 4 | MAX_BIT - "Access Denied", // RETURN_ACCESS_DENIED =3D 1= 5 | MAX_BIT - "No Response", // RETURN_NO_RESPONSE =3D 1= 6 | MAX_BIT - "No mapping", // RETURN_NO_MAPPING =3D 1= 7 | MAX_BIT - "Time out", // RETURN_TIMEOUT =3D 1= 8 | MAX_BIT - "Not started", // RETURN_NOT_STARTED =3D 1= 9 | MAX_BIT - "Already started", // RETURN_ALREADY_STARTED =3D 2= 0 | MAX_BIT - "Aborted", // RETURN_ABORTED =3D 2= 1 | MAX_BIT - "ICMP Error", // RETURN_ICMP_ERROR =3D 2= 2 | MAX_BIT - "TFTP Error", // RETURN_TFTP_ERROR =3D 2= 3 | MAX_BIT - "Protocol Error", // RETURN_PROTOCOL_ERROR =3D 2= 4 | MAX_BIT - "Incompatible Version", // RETURN_INCOMPATIBLE_VERSION =3D 2= 5 | MAX_BIT - "Security Violation", // RETURN_SECURITY_VIOLATION =3D 2= 6 | MAX_BIT - "CRC Error", // RETURN_CRC_ERROR =3D 2= 7 | MAX_BIT - "End of Media", // RETURN_END_OF_MEDIA =3D 2= 8 | MAX_BIT - "Reserved (29)", // RESERVED =3D 2= 9 | MAX_BIT - "Reserved (30)", // RESERVED =3D 3= 0 | MAX_BIT - "End of File", // RETURN_END_OF_FILE =3D 3= 1 | MAX_BIT - "Invalid Language", // RETURN_INVALID_LANGUAGE =3D 3= 2 | MAX_BIT - "Compromised Data" // RETURN_COMPROMISED_DATA =3D 3= 3 | MAX_BIT -}; +GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 *mErrorString =3D = \ + "Load Error\0" /* RETURN_LOAD_ERROR =3D = 1 | MAX_BIT */ \ + "Invalid Parameter\0" /* RETURN_INVALID_PARAMETER =3D = 2 | MAX_BIT */ \ + "Unsupported\0" /* RETURN_UNSUPPORTED =3D = 3 | MAX_BIT */ \ + "Bad Buffer Size\0" /* RETURN_BAD_BUFFER_SIZE =3D = 4 | MAX_BIT */ \ + "Buffer Too Small\0" /* RETURN_BUFFER_TOO_SMALL, =3D = 5 | MAX_BIT */ \ + "Not Ready\0" /* RETURN_NOT_READY =3D = 6 | MAX_BIT */ \ + "Device Error\0" /* RETURN_DEVICE_ERROR =3D = 7 | MAX_BIT */ \ + "Write Protected\0" /* RETURN_WRITE_PROTECTED =3D = 8 | MAX_BIT */ \ + "Out of Resources\0" /* RETURN_OUT_OF_RESOURCES =3D = 9 | MAX_BIT */ \ + "Volume Corrupt\0" /* RETURN_VOLUME_CORRUPTED =3D = 10 | MAX_BIT */ \ + "Volume Full\0" /* RETURN_VOLUME_FULL =3D = 11 | MAX_BIT */ \ + "No Media\0" /* RETURN_NO_MEDIA =3D = 12 | MAX_BIT */ \ + "Media changed\0" /* RETURN_MEDIA_CHANGED =3D = 13 | MAX_BIT */ \ + "Not Found\0" /* RETURN_NOT_FOUND =3D = 14 | MAX_BIT */ \ + "Access Denied\0" /* RETURN_ACCESS_DENIED =3D = 15 | MAX_BIT */ \ + "No Response\0" /* RETURN_NO_RESPONSE =3D = 16 | MAX_BIT */ \ + "No mapping\0" /* RETURN_NO_MAPPING =3D = 17 | MAX_BIT */ \ + "Time out\0" /* RETURN_TIMEOUT =3D = 18 | MAX_BIT */ \ + "Not started\0" /* RETURN_NOT_STARTED =3D = 19 | MAX_BIT */ \ + "Already started\0" /* RETURN_ALREADY_STARTED =3D = 20 | MAX_BIT */ \ + "Aborted\0" /* RETURN_ABORTED =3D = 21 | MAX_BIT */ \ + "ICMP Error\0" /* RETURN_ICMP_ERROR =3D = 22 | MAX_BIT */ \ + "TFTP Error\0" /* RETURN_TFTP_ERROR =3D = 23 | MAX_BIT */ \ + "Protocol Error\0" /* RETURN_PROTOCOL_ERROR =3D = 24 | MAX_BIT */ \ + "Incompatible Version\0" /* RETURN_INCOMPATIBLE_VERSION =3D = 25 | MAX_BIT */ \ + "Security Violation\0" /* RETURN_SECURITY_VIOLATION =3D = 26 | MAX_BIT */ \ + "CRC Error\0" /* RETURN_CRC_ERROR =3D = 27 | MAX_BIT */ \ + "End of Media\0" /* RETURN_END_OF_MEDIA =3D = 28 | MAX_BIT */ \ + "Reserved (29)\0" /* RESERVED =3D = 29 | MAX_BIT */ \ + "Reserved (30)\0" /* RESERVED =3D = 30 | MAX_BIT */ \ + "End of File\0" /* RETURN_END_OF_FILE =3D = 31 | MAX_BIT */ \ + "Invalid Language\0" /* RETURN_INVALID_LANGUAGE =3D = 32 | MAX_BIT */ \ + "Compromised Data"; /* RETURN_COMPROMISED_DATA =3D = 33 | MAX_BIT */ + + +CONST CHAR8 * +FindNthStr ( + IN CONST CHAR8 *Start, + IN UINTN Index + ) +{ + CONST CHAR8 *str; + + for (str =3D Start; Index > 0; str++) { + if (*str =3D=3D '\0') { + Index--; + if (Index =3D=3D 0) { + str++; + break; + } + } + } + + return str; +} =20 =20 /** @@ -1005,12 +1025,12 @@ BasePrintLibSPrintMarker ( // Index =3D Status & ~MAX_BIT; if (Index > 0 && Index <=3D ERROR_STATUS_NUMBER) { - ArgumentString =3D mErrorString [Index - 1]; + ArgumentString =3D FindNthStr (mErrorString, Index - 1); } } else { Index =3D Status; if (Index <=3D WARNING_STATUS_NUMBER) { - ArgumentString =3D mWarningString [Index]; + ArgumentString =3D FindNthStr (mWarningString, Index); } } if (ArgumentString =3D=3D ValueBuffer) { Thanks, Andrew Fish > On Jun 15, 2020, at 6:57 PM, Liming Gao wrote: >=20 > This data is great. The change is good. Reviewed-by: Liming Gao > > > From: Liu, Zhiguang >=20 > Sent: 2020=E5=B9=B46=E6=9C=8815=E6=97=A5 15:34 > To: Ard Biesheuvel >; Gao, Liming >; deve= l@edk2.groups.io > Cc: Kinney, Michael D > > Subject: RE: [edk2-devel] [PATCH v3] MdePkg/BasePrintLib: avoid absolute= addresses for error strings > > Hi Ard, > > I also collected the image size of OVMFX64 size building with VS2015x86. > > Debug > Release > > before > after > After-before > before > after > after-before > sec > 27664 > 27409 > -255 > 13968 > 13968 > 0 > pei > 223016 > 221000 > -2016 > 107208 > 106984 > -224 > dxe > 4507000 > 4481336 > -25664 > 2987064 > 2979384 > -7680 > compact > 1179776 > 1172528 > -7248 > 922664 > 920304 > -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 > > Cc: Kinney, Michael D >; Liu, Zhiguang > > > > > Subject: Re: [edk2-devel] [PATCH v3] MdePkg/BasePrintLib: avoid absolu= te > > addresses for error strings > >=20 > > On 6/12/20 4:33 PM, Gao, Liming wrote: > > > Ard: > > > I will collect the image size on OVMF X64 platform with this patc= h. > > > > >=20 > > Building OvmfPkgX64.dsc in RELEASE mode using GCC5 profile gives me > >=20 > >=20 > > Before: > > SECFV [5%Full] 212992 total, 11760 used, 201232 free PEIFV [9%Full] 91= 7504 > > total, 89384 used, 828120 free DXEFV [22%Full] 12582912 total, 2806320= used, > > 9776592 free FVMAIN_COMPACT [26%Full] 3440640 total, 918760 used, > > 2521880 free > >=20 > > After: > > SECFV [5%Full] 212992 total, 11760 used, 201232 free PEIFV [9%Full] 91= 7504 > > total, 89192 used, 828312 free DXEFV [22%Full] 12582912 total, 2802928= used, > > 9779984 free FVMAIN_COMPACT [26%Full] 3440640 total, 916784 used, > > 2523856 free > >=20 > > So no change for SECFV, -192 bytes for PEIFV, -3392 bytes for DXEFV an= d > > -1976 bytes for the resulting outer FV image. > >=20 > >=20 > >=20 > > >> -----Original Message----- > > >> From: devel@edk2.groups.io > 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,= Liming > > > >> Subject: [edk2-devel] [PATCH v3] MdePkg/BasePrintLib: avoid absolut= e > > 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 linea= r list > > >> of 64-bit quantities, each containing the absolute address of one o= f the > > >> string literals in memory. > > >> > > >> This means that each string takes up 8 bytes of additional space, a= long > > >> with 2 bytes of relocation data. It also means that extra work need= s to > > >> be done at runtime to process these relocations, every time a modul= e is > > >> loaded that incorporates this library. > > >> > > >> So fix both issues, by splitting mStatusString into two arrays of c= har > > >> arrays. The memory footprint decreases from 955 to 843 bytes, and g= iven > > >> that in the latter case, the overhead consists of 278 NUL character= s 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: > > >> > > >> Before > > >> > > >> FV Space Information > > >> FVMAIN [100%Full] 5329920 total, 5329920 used, 0 free > > >> FVMAIN_COMPACT [38%Full] 2093056 total, 811840 used, 1281216 fre= e > > >> > > >> After > > >> > > >> FV Space Information > > >> FVMAIN [100%Full] 5321728 total, 5321728 used, 0 free > > >> FVMAIN_COMPACT [38%Full] 2093056 total, 809696 used, 1283360 fre= e > > >> > > >> So the uncompressed contents of the compressed image are 8 KB small= er, > > >> whereas the resulting flash image (consisting of the compressed ima= ge > > >> 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 arr= ay is > > >> based on > > >> > > >> v2: > > >> - split off this patch from the StandaloneMmPkg series, since they = are not > > >> interdependent anyway, and so they can be discussed separately > > >> - remove mention of StandaloneMmPkg from the commit log - the space > > savings > > >> 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 > > >> can use smaller entries > > >> - clarify the commit log to explain the effect on compressed as wel= l as > > >> XIP images (which both get smaller) > > >> > > >> MdePkg/Library/BasePrintLib/PrintLibInternal.c | 15 ++++++++++++-= -- > > >> 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 @@ > > >> > > >> > > >> 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 { > > >> > > >> "Success", // RETURN_SUCCESS = =3D 0 > > >> > > >> "Warning Unknown Glyph", // RETURN_WARN_UNKNOWN_GLYPH > > =3D 1 > > >> > > >> "Warning Delete Failure", // RETURN_WARN_DELETE_FAILURE = =3D 2 > > >> > > >> "Warning Write Failure", // RETURN_WARN_WRITE_FAILURE = =3D 3 > > >> > > >> "Warning Buffer Too Small", // > > RETURN_WARN_BUFFER_TOO_SMALL =3D 4 > > >> > > >> "Warning Stale Data", // RETURN_WARN_STALE_DATA = =3D 5 > > >> > > >> +}; > > >> > > >> + > > >> > > >> +// > > >> > > >> +// Longest string: RETURN_INCOMPATIBLE_VERSION =3D> 20 characters > > plus NUL byte > > >> > > >> +// > > >> > > >> +GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 > > mErrorString[][20+1] =3D { > > >> > > >> "Load Error", // RETURN_LOAD_ERROR = =3D 1 | MAX_BIT > > >> > > >> "Invalid Parameter", // RETURN_INVALID_PARAMETER = =3D 2 | > > MAX_BIT > > >> > > >> "Unsupported", // RETURN_UNSUPPORTED = =3D 3 | > > MAX_BIT > > >> > > >> @@ -996,12 +1005,12 @@ BasePrintLibSPrintMarker ( > > >> // > > >> > > >> Index =3D Status & ~MAX_BIT; > > >> > > >> if (Index > 0 && Index <=3D ERROR_STATUS_NUMBER) { > > >> > > >> - ArgumentString =3D mStatusString [Index + > > WARNING_STATUS_NUMBER]; > > >> > > >> + ArgumentString =3D mErrorString [Index - 1]; > > >> > > >> } > > >> > > >> } else { > > >> > > >> Index =3D Status; > > >> > > >> if (Index <=3D WARNING_STATUS_NUMBER) { > > >> > > >> - ArgumentString =3D mStatusString [Index]; > > >> > > >> + ArgumentString =3D mWarningString [Index]; > > >> > > >> } > > >> > > >> } > > >> > > >> if (ArgumentString =3D=3D ValueBuffer) { > > >> > > >> -- > > >> 2.26.2 > > >> > > >> > > >> -=3D-=3D-=3D-=3D-=3D-=3D > > >> Groups.io Links: You receive all messages sent = to 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 --Apple-Mail=_EBC707D1-F0F8-473D-949A-DEEC2794F2F7 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
I was won= dering what would happen if we converted the CHAR8 arrays in to strings wit= h multiple nulls [1]. Looks like it saves space in uncompressed FVs, but no= t in compressed FVs.  

Here are the Xcode numbers for X64 DEBUG Ovmf:

With this Patch:
SECFV [14%Full] 212992 total, 30128 used, 18= 2864 free
PEIFV [29%Ful= l] 917504 total, 273192 used, 644312 free
DXEFV [39%Full] 12582912 total, 4997120 used, 7585792 fr= ee
FVMAIN_COMPACT [36%F= ull] 3440640 total, 1271264 used, 2169376 free
=
Vs my patch:
SECFV [14%Full] 212992 total, 29= 872 used, 183120 free
PEIFV [29%Full] 917504 total, 271048 used, 646456 free
<= div style=3D"margin: 0px; font-stretch: normal; font-size: 11px; line-heigh= t: normal; font-family: Menlo;" class=3D"">DXEFV [39%Full] 12582912 total, 4979= 552 used, 7603360 free
FVMAIN_COMPACT [36%Full] 3440640 total, 1271824 used, 2168816 free

SEC: -256
PEI: -2,144
Dxe: -17,568
Compact: +560

[1] git diff
diff --git a/MdePkg/Library/BasePrintLib/PrintLibInternal.= c b/MdePkg/Library/BasePrintLib/PrintLibInternal.c
index 50c6e8559c43..db2533e7a= ffb 100644
--- a/MdePkg/Library/BasePrintLib/PrintLibInternal.c
+++ b/MdePkg/Library= /BasePrintLib/PrintLibInternal.c
@@ -30,53 +30,73 @@ GLOBAL_REMOVE_IF_UNREF= ERENCED CONST CHAR8 mHexStr[] =3D {'0','1','2','3','4','5','
 //
 // Longest string: RETURN_WARN_BUFFER_TOO_SMA= LL =3D> 24 characters plus NUL byte
 //
-GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 mWarn= ingString[][24+1] =3D {
-  "Success",        &nb= sp;             //  RETURN_SUCCESS =               =3D 0
-  "Warni= ng Unknown Glyph",        //  RETURN_WARN_UNKNOWN_= GLYPH     =3D 1
-  "Warning Delete Failure",    =   //  RETURN_WARN_DELETE_FAILURE    =3D 2
=
-  "W= arning Write Failure",        //  RETURN_WARN_WRIT= E_FAILURE     =3D 3
-  "Warning Buffer Too Small",   =   //  RETURN_WARN_BUFFER_TOO_SMALL  =3D 4
-  "Warni= ng Stale Data",           //  RETURN_WARN_STA= LE_DATA        =3D 5
-};
+GLOBAL_REMOVE_IF_UNREFERE= NCED CONST CHAR8 *mWarningString =3D           &nb= sp;     \
+  "Success\0"         =             /*  RETURN_SUCCESS  &n= bsp;             =3D 0 */ \
+  "Warni= ng Unknown Glyph\0"        /*  RETURN_WARN_UNKNOWN= _GLYPH     =3D 1 */ \
+  "Warning Delete Failure\0"  =     /*  RETURN_WARN_DELETE_FAILURE    =3D 2 */ \<= /span>
+  "Warning Write Failure\0"        /*  RE= TURN_WARN_WRITE_FAILURE     =3D 3 */ \
+  "Warning Buffer = Too Small\0"     /*  RETURN_WARN_BUFFER_TOO_SMALL  =3D = 4 */ \
+  "Warning Stale Data";          &n= bsp; /*  RETURN_WARN_STALE_DATA        =3D 5 */

 

 //
&n= bsp;// Longest string: RETURN_INCOMPATIBLE_VERSION =3D> 20 characters pl= us NUL byte
 //
-GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 mErrorString[][20+1] =3D {
-  "Load Error",               &= nbsp;   //  RETURN_LOAD_ERROR           =   =3D 1  | MAX_BIT
-  "Invalid Parameter",    &n= bsp;       //  RETURN_INVALID_PARAMETER    &n= bsp; =3D 2  | MAX_BIT
-  "Unsupported",      &nb= sp;           //  RETURN_UNSUPPORTED  &n= bsp;         =3D 3  | MAX_BIT
-  "Bad Buffe= r Size",              //  RETURN_BA= D_BUFFER_SIZE        =3D 4  | MAX_BIT
=
-  "B= uffer Too Small",             //  RETURN= _BUFFER_TOO_SMALL,      =3D 5  | MAX_BIT
-  "Not= Ready",                  &nbs= p; //  RETURN_NOT_READY             = ; =3D 6  | MAX_BIT
-  "Device Error",       &nbs= p;         //  RETURN_DEVICE_ERROR     &= nbsp;     =3D 7  | MAX_BIT
-  "Write Protected", = ;             //  RETURN_WRITE_PROTECTED=         =3D 8  | MAX_BIT
-  "Out of Resourc= es",             //  RETURN_OUT_OF_RESOU= RCES       =3D 9  | MAX_BIT
-  "Volume Corrupt",=               //  RETURN_VOLUME_CO= RRUPTED       =3D 10 | MAX_BIT
-  "Volume Full", = ;                 //  RETURN_V= OLUME_FULL            =3D 11 | MAX_BIT=
= -&nb= sp; "No Media",                 &nb= sp;   //  RETURN_NO_MEDIA           &nbs= p;   =3D 12 | MAX_BIT
-  "Media changed",      &= nbsp;         //  RETURN_MEDIA_CHANGED   = ;       =3D 13 | MAX_BIT
-  "Not Found",   =                 //  RETURN_NO= T_FOUND              =3D 14 | MAX_BIT
-  "Access Denied",             =   //  RETURN_ACCESS_DENIED          =3D= 15 | MAX_BIT
-  "No Response",          &n= bsp;       //  RETURN_NO_RESPONSE      &= nbsp;     =3D 16 | MAX_BIT
-  "No mapping",     =               //  RETURN_NO_MAPPING=             =3D 17 | MAX_BIT
-  "Time= out",                    = ; //  RETURN_TIMEOUT              &= nbsp; =3D 18 | MAX_BIT
-  "Not started",        =           //  RETURN_NOT_STARTED   =         =3D 19 | MAX_BIT
-  "Already started",&= nbsp;             //  RETURN_ALREADY_STA= RTED        =3D 20 | MAX_BIT
-  "Aborted", =                     //&n= bsp; RETURN_ABORTED                = = =3D 21 | MAX_BIT
-  "ICMP Error",          = ;         //  RETURN_ICMP_ERROR     &nbs= p;       =3D 22 | MAX_BIT
-  "TFTP Error",   &nb= sp;               //  RETURN_TFTP_E= RROR             =3D 23 | MAX_BIT
-  "= Protocol Error",               //  = RETURN_PROTOCOL_ERROR         =3D 24 | MAX_BIT
- = ; "Incompatible Version",         //  RETURN_INCOM= PATIBLE_VERSION   =3D 25 | MAX_BIT
-  "Security Violation", &nb= sp;         //  RETURN_SECURITY_VIOLATION   &= nbsp; =3D 26 | MAX_BIT
-  "CRC Error",        &n= bsp;           //  RETURN_CRC_ERROR  &nb= sp;           =3D 27 | MAX_BIT
-  "End o= f Media",                 //  = RETURN_END_OF_MEDIA           =3D 28 | MAX_BIT
-=   "Reserved (29)",              &nb= sp; //  RESERVED               = ;       =3D 29 | MAX_BIT
-  "Reserved (30)",  &n= bsp;             //  RESERVED  &nbs= p;                   =3D 30 | = MAX_BIT
-  "End of File",            &= nbsp;     //  RETURN_END_OF_FILE        =     =3D 31 | MAX_BIT
-  "Invalid Language",     =         //  RETURN_INVALID_LANGUAGE     =   =3D 32 | MAX_BIT
-  "Compromised Data"      &n= bsp;       //  RETURN_COMPROMISED_DATA     &n= bsp; =3D 33 | MAX_BIT
-};
+GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 *m= ErrorString =3D                &nbs= p;             \
+  "Load Error\0" &nb= sp;                 /*  RETURN= _LOAD_ERROR             =3D 1  | MAX_BIT= */ \
+  "Invalid Parameter\0"          &nb= sp; /*  RETURN_INVALID_PARAMETER      =3D 2  | MAX= _BIT */ \
+  "Unsupported\0"           = ;       /*  RETURN_UNSUPPORTED      &nbs= p;     =3D 3  | MAX_BIT */ \
+  "Bad Buffer Size\0"&n= bsp;             /*  RETURN_BAD_BUFFER_S= IZE        =3D 4  | MAX_BIT */ \
+  "Buffe= r Too Small\0"             /*  RETURN_BU= FFER_TOO_SMALL,      =3D 5  | MAX_BIT */ \
=
+  "N= ot Ready\0"                  &= nbsp; /*  RETURN_NOT_READY            &n= bsp; =3D 6  | MAX_BIT */ \
+  "Device Error\0"     &n= bsp;           /*  RETURN_DEVICE_ERROR  =         =3D 7  | MAX_BIT */ \
+  "Write= Protected\0"              /*  RETU= RN_WRITE_PROTECTED        =3D 8  | MAX_BIT */ \
+  "Out of Resources\0"             /= *  RETURN_OUT_OF_RESOURCES       =3D 9  | MAX_BIT = */ \
+  "Volume Corrupt\0"            =   /*  RETURN_VOLUME_CORRUPTED       =3D 10 | MAX_= BIT */ \
+  "Volume Full\0"           =       /*  RETURN_VOLUME_FULL       = ;     =3D 11 | MAX_BIT */ \
+  "No Media\0"     =                 /*  RETURN_NO_= MEDIA               =3D 12 | MAX_BIT */ = \
+  "Media changed\0"            &= nbsp;   /*  RETURN_MEDIA_CHANGED         = ; =3D 13 | MAX_BIT */ \
+  "Not Found\0"        =             /*  RETURN_NOT_FOUND  &= nbsp;           =3D 14 | MAX_BIT */ \
=
+  "A= ccess Denied\0"                /*&n= bsp; RETURN_ACCESS_DENIED          =3D 15 | MAX_BI= T */ \
+  "No Response\0"            &= nbsp;     /*  RETURN_NO_RESPONSE        =     =3D 16 | MAX_BIT */ \
+  "No mapping\0"     =               /*  RETURN_NO_MAPPING=             =3D 17 | MAX_BIT */ \
+  = "Time out\0"                  =   /*  RETURN_TIMEOUT            &n= bsp;   =3D 18 | MAX_BIT */ \
+  "Not started\0"    &n= bsp;             /*  RETURN_NOT_STARTED&= nbsp;           =3D 19 | MAX_BIT */ \
=
+  "A= lready started\0"              /*  = RETURN_ALREADY_STARTED        =3D 20 | MAX_BIT */ \
+=   "Aborted\0"                &= nbsp;     /*  RETURN_ABORTED        &nbs= p;       =3D 21 | MAX_BIT */ \
+  "ICMP Error\0" &nbs= p;                 /*  RETURN_= ICMP_ERROR             =3D 22 | MAX_BIT */ \<= /span>
+  "TFTP Error\0"               =     /*  RETURN_TFTP_ERROR          =   =3D 23 | MAX_BIT */ \
+  "Protocol Error\0"     &n= bsp;         /*  RETURN_PROTOCOL_ERROR   &nbs= p;     =3D 24 | MAX_BIT */ \
+  "Incompatible Version\0" &= nbsp;       /*  RETURN_INCOMPATIBLE_VERSION   =3D = 25 | MAX_BIT */ \
+  "Security Violation\0"       &nb= sp;   /*  RETURN_SECURITY_VIOLATION     =3D 26 | MAX_BI= T */ \
+  "CRC Error\0"            &nb= sp;       /*  RETURN_CRC_ERROR      &nbs= p;       =3D 27 | MAX_BIT */ \
+  "End of Media\0" &n= bsp;               /*  RETURN_END_O= F_MEDIA           =3D 28 | MAX_BIT */ \
+  = "Reserved (29)\0"                /*=   RESERVED                &nbs= p;     =3D 29 | MAX_BIT */ \
+  "Reserved (30)\0"  &n= bsp;             /*  RESERVED  &nbs= p;                   =3D 30 | = MAX_BIT */ \
+  "End of File\0"          &n= bsp;       /*  RETURN_END_OF_FILE      &= nbsp;     =3D 31 | MAX_BIT */ \
+  "Invalid Language\0" &n= bsp;           /*  RETURN_INVALID_LANGUAGE &n= bsp;     =3D 32 | MAX_BIT */ \
+  "Compromised Data"; = ;             /*  RETURN_COMPROMISED_DAT= A       =3D 33 | MAX_BIT */
+
+
+CONST CHAR8 *
+F= indNthStr (
+  IN CONST CHAR8 *Start,
+  IN UINTN   &nbs= p;   Index
+  )
+{
+  CONST CHAR8 *str;
+
+  = for (str =3D Start; Index > 0; str++) {
+    if (*str =3D=3D= '\0') {
+      Index--;
+      if (Index= =3D=3D 0) {
+        str++;
+    &nbs= p;   break;
+      }
+    }
<= div style=3D"margin: 0px; font-stretch: normal; font-size: 11px; line-heigh= t: normal; font-family: Menlo; color: rgb(47, 180, 29);" class=3D"">+  }
+
+  return str;
+}

 

 =

 /**
<= span style=3D"font-variant-ligatures: no-common-ligatures; color: #2eaebb" = class=3D"">@@ -1005,12 +1025,12 @@ BasePrintLibSPrintMarker (
        =   //
  =         Index =3D Status & ~MAX_BIT;
<= div style=3D"margin: 0px; font-stretch: normal; font-size: 11px; line-heigh= t: normal; font-family: Menlo;" class=3D"">         &n= bsp; if (Index > 0 && Index <=3D ERROR_STATUS_NUMBER) {
-&n= bsp;           ArgumentString =3D mErrorString [In= dex - 1];
+            ArgumentString =3D F= indNthStr (mErrorString, Index - 1);
           }
         } else = {
     &= nbsp;     Index =3D Status;
           if (Index <=3D W= ARNING_STATUS_NUMBER) {
-            Argume= ntString =3D mWarningString [Index];
+          =   ArgumentString =3D FindNthStr (mWarningString, Index);
<= div style=3D"margin: 0px; font-stretch: normal; font-size: 11px; line-heigh= t: normal; font-family: Menlo;" class=3D"">         &n= bsp; }
   &= nbsp;     }
&= nbsp;        if (ArgumentString =3D=3D ValueBuffer) {

Thanks,

Andrew Fish

On Jun 15, 2020, at 6:57 PM, Liming Gao <liming.gao@intel.com>= ; wrote:

This data is great. The change is good. Review= ed-by: Liming Gao <liming.gao@inte= l.com>
 
From: Liu, Zhiguang <zhiguang.liu= @intel.com> 
Sent: = ;2020
=E5=B9= =B46=E6=9C=8815<= /span>=E6=97=A5 
15:34
To: Ard Biesheuvel <ard.biesheuvel@arm.com>; Gao, Liming <liming.gao@intel.com>; devel@edk2.gro= ups.io
Cc: Kinney, Michael D <michael.d.kinney@intel.com>
Subject: RE: [edk2-d= evel] [PATCH v3] MdePkg/BasePrintLib: avoid absolute addresses for error st= rings
 <= /div>
Hi Ard,
 
I also collected the image size = of OVMFX64 size building with VS2015x86.
=
0=
107208
= =
 <= /span>
Debug
Release
 
before
after
After-before
before
after
after-before<= o:p class=3D"">
sec
27664
27409
-255<= /div>
13968=
13968
pei
223016
22100= 0
-2016
106984
-224
dxe
4507000<= /div>
4481= 336
-25664
2987064
2979384
-7680<= /o:p>
compact
1179776=
117= 2528
-7248
922664
920304
-2360<= /o:p>
 
It can reduce the im= age size in X64.
Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com>
 
> -----Original Message-----
> From: Ard Biesheuvel <ard.biesheuvel@arm.com>
=
> Sent: Frid= ay, June 12, 2020 11:11 PM
> Cc: Kinney, Michael= D <michael.d.kinney@intel.c= om>; Liu, Zhiguang
> S= ubject: Re: [edk2-devel] [PATCH v3] MdePkg/BasePrintLib: avoid absolute
> addresses for error strings
> 
> On= 6/12/20 4:33 PM, Gao, Liming wrote:
> > Ard:
> >    I will collect the image size on= OVMF X64 platform with this patch.
> >
> 
> Building OvmfPkgX64.dsc in RELEASE mode using GCC5 profile = gives me
> = ;
> = ;
> Before:
=
> SECFV [5%F= ull] 212992 total, 11760 used, 201232 free PEIFV [9%Full] 917504
> total, 89384 used, 828120 free DXEFV [22%Full] 12582912 tot= al, 2806320 used,
> 9776592 free FVMAIN_COMPACT [26= %Full] 3440640 total, 918760 used,
> 2521880 free
> 
> After:
> SECFV [5%Full] 212992 t= otal, 11760 used, 201232 free PEIFV [9%Full] 917504
>= total, 89192 used, 828312 free DXEFV [22%Full] 12582912 total, 2802928 use= d,
> 9779984 free FVMAIN_COMPACT [26%Full] 3440640 t= otal, 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-----<= /o:p>
> >> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Ard=
&g= t; Biesheuvel
> >> Sent: Friday, June 12, 2020 = 6:35 AM
> >> Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>; Kinney, Mich= ael D
> &g= t;> Subject: [edk2-devel] [PATCH v3] MdePkg/BasePrintLib: avoid absolute=
> addresses for error strings
= > >>
> >> The mStatusString[] array is= constructed as an array of pointer-to-char,
> >&g= t; which means that on X64 or AARCH64, it is emitted as a single linear lis= t
> >> of 64-bit quantities, each containing = the absolute address of one of the
> >> string = literals in memory.
> >><= /span>
>= ; >> This means that each string takes up 8 bytes of additional space= , along
> >> with 2 bytes of relocation data. I= t also means that extra work needs to
> >> be d= one at runtime to process these relocations, every time a module is
> >> loaded that incorporates this library.
> >>
> >> So fix both issue= s, by splitting mStatusString into two arrays of char=
&g= t; >> arrays. The memory footprint decreases from 955 to 843 bytes, a= nd given
> >> that in the latter case, the over= head consists of 278 NUL characters rather
> >>= than 390 bytes worth of absolute addresses and relocation records, the
> size
> >> of a compressed = image is reduced even further. For example, when
> bu= ilding
> >> ArmVirtQemu.dsc in RELEASE mode for= AARCH64 with the GCC5 profile, I
> get:
> >>
> >>    Bef= ore
> >>
> >> =   FV Space Information
> >> &nb= sp;  FVMAIN [100%Full] 5329920 total, 5329920 used, 0 free
> >>    FVMAIN_COMPACT [38%Full] 2093056= total, 811840 used, 1281216 free
> >>
> >>    After
> &g= t;>
> >>    FV Space Informat= ion
> >>    FVMAIN [100%Full] 53= 21728 total, 5321728 used, 0 free
> >> &nb= sp;  FVMAIN_COMPACT [38%Full] 2093056 total, 809696 used, 1283360 free=
> >>
> >> So th= e uncompressed contents of the compressed image are 8 KB smaller,
> >> whereas the resulting flash image (consisting of t= he compressed image
> >> along with SEC, PEI_CO= RE and a set of PEIMs that execute in place) is
> >= ;> 2 KB smaller.
> >><= /span>
>= ; >> Cc: "Kinney, Michael D" <michael.d.kinney@intel.com>
> >>= ; Cc: "Gao, Liming" <liming.gao@intel= .com>
> >> Signed-off-by: Ard Bie= sheuvel <ard.biesheuvel@arm.com= >
> >> ---<= /div>
> >&= gt; v3:
> >> - add code comments to explain wha= t the inner dimension of each array is
> >>&nbs= p;   based on
> >>
> >> v2:
> >> - split off this patch= from the StandaloneMmPkg series, since they are not<= /span>
>= ; >>    interdependent anyway, and so they can be disc= ussed separately
> >> - remove mention of St= andaloneMmPkg from the commit log - the space<= /div>
> savin= gs
> >>    by themselves are su= fficient justification
> >> - update the before= /after numbers with the current results
<= div style=3D"margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibr= i, sans-serif;" class=3D"">> >> - = split the warnings and errors into a separate array, so that the latter
> >>    can use smaller entries
> >> - clarify the commit log to explain the effec= t on compressed as well as
> >>  &nbs= p; XIP images (which both get smaller)
> >>
> >>   MdePkg/Library/BasePrintLib/Print= LibInternal.c | 15 ++++++++++++---
> >> &n= bsp; 1 file changed, 12 insertions(+), 3 deletions(-)=
&g= t; >>
<= span lang=3D"EN-US" class=3D"">> >> diff --git a/MdePkg/Library/Ba= sePrintLib/PrintLibInternal.c
> b/MdePkg/Library/Ba= sePrintLib/PrintLibInternal.c
> >> index b6ec= 5ac4fbb9..50c6e8559c43 100644
> >> --- a/MdeP= kg/Library/BasePrintLib/PrintLibInternal.c
> >>= +++ b/MdePkg/Library/BasePrintLib/PrintLibInternal.c=
&g= t; >> @@ -27,13 +27,22 @@
> >>
> >>
> >>   GLOBA= L_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_UNREFERE= NCED CONST CHAR8 * CONST
> mStatusString[] =3D {
> >>
> >> +//
> >>
> >> +// Longest str= ing: RETURN_WARN_BUFFER_TOO_SMALL =3D> 24
> charac= ters plus NUL byte
> >><= /span>
>= ; >> +//
> >>
> >= ;> +GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8
> mW= arningString[][24+1] =3D {
> >>=
> >>     "Success",   &n= bsp;            = ;      //  RETURN_SUCCESS   &n= bsp;            =3D = 0
> >>
> >> =    "Warning Unknown Glyph",     &n= bsp;  //  RETURN_WARN_UNKNOWN_GLYPH<= /div>
> =3D 1=
> >>
> >> =     "Warning Delete Failure",     &= nbsp; //  RETURN_WARN_DELETE_FAILURE    =3D 2
> >>
> >>   =   "Warning Write Failure",        /= /  RETURN_WARN_WRITE_FAILURE     =3D 3
> >>
> >>   =   "Warning Buffer Too Small",     //
> RETURN_WARN_BUFFER_TOO_SMALL  =3D 4<= /span>
>= ; >>
> >>     "Warnin= g Stale Data",           = //  RETURN_WARN_STALE_DATA        = =3D 5
> >>
<= div style=3D"margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibr= i, sans-serif;" class=3D"">> >> +}= ;
> >>
> >> +
> >>
> >> +//
> >>
> >> +// Longest str= ing: RETURN_INCOMPATIBLE_VERSION =3D> 20 characters
&= gt; plus NUL byte
> >><= /span>
>= ; >> +//
> >>
> >= ;> +GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8
> mE= rrorString[][20+1] =3D {
> >>
> >>     "Load Error",   &nbs= p;            &= nbsp;  //  RETURN_LOAD_ERROR      &= nbsp;      =3D 1  | MAX_BIT
> >>
> >>     "I= nvalid Parameter",         &nb= sp;  //  RETURN_INVALID_PARAMETER      = =3D 2  |
> MAX_BIT=
> >= >
> >>     "Unsupported"= ,            &n= bsp;     //  RETURN_UNSUPPORTED   &= nbsp;        =3D 3  |
> MAX_BIT
> >><= /span>
>= ; >> @@ -996,12 +1005,12 @@ BasePrintLibSPrintMarker (
> >>         &= nbsp;   //
> >>=
&g= t; >>          &nbs= p;  Index =3D Status & ~MAX_BIT;
> >><= o:p class=3D"">
> >>       &= nbsp;     if (Index > 0 && Index <=3D ERR= OR_STATUS_NUMBER) {
> >><= /span>
>= ; >> -          &nb= sp; ArgumentString =3D mStatusString [Index +<= /div>
> WARNI= NG_STATUS_NUMBER];
> >><= /span>
>= ; >> +          &nb= sp; ArgumentString =3D mErrorString [Index - 1];
> &g= t;>
> >>      =        }
> >>
> >>       &nbs= p;   } else {
> >>
> >>          &= nbsp;  Index =3D Status;
> >>
> >>        &nb= sp;    if (Index <=3D WARNING_STATUS_NUMBER) {
> >>
> >> -  &nbs= p;         ArgumentString =3D mStat= usString [Index];
> >><= /span>
>= ; >> +          &nb= sp; ArgumentString =3D mWarningString [Index];=
> >= >
> >>      &n= bsp;      }
> >>
> >>        =    }
> >>
> >= ;>           if (Argum= entString =3D=3D ValueBuffer) {
> >>
> >> --
> >> 2.26.2
> >>
> >><= /o:p>
> >> -=3D-=3D-=3D-=3D-=3D-=3D
> >><= span class=3D"Apple-converted-space"> Groups.io Links: Y= ou receive all messages sent to this group.
> >>= ;
> >> View/Reply Online (#61170):
> >> Group Owner:=  devel+owner@edk2.groups.= io
> [<= a href=3D"mailto:liming.gao@intel.com" style=3D"color: rgb(5, 99, 193); tex= t-decoration: underline;" class=3D"">liming.gao@intel.com]
> >> -=3D-=3D-=3D-=3D-=3D-=3D<= /div>
> ><= o:p class=3D"">
 

--Apple-Mail=_EBC707D1-F0F8-473D-949A-DEEC2794F2F7--