From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on071c.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe42::71c]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5886C81EB3 for ; Fri, 9 Dec 2016 08:32:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=ht3PrQflSnWDSjzEYdCLBU885+P5HMOAwkUFoBt2InU=; b=VBN80pjk8BDbEfQk7TOfIMI83zNakyhkr3ZsBtHRNWNQ1VSzF5Gun9MYsvfFbDYRDNKcK/NZzrohHE7O6ah7HtXkM8VvUl/LYTyKx73iTWis2Y4So08YkgFPWSwrB0lh5Mwc3ASxalhWOPpjqRIyaN0xaSmabaCQL2LPuJtLxns= Received: from CY1PR03MB2345.namprd03.prod.outlook.com (10.166.207.144) by CY1PR03MB2348.namprd03.prod.outlook.com (10.166.207.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.771.8; Fri, 9 Dec 2016 16:32:41 +0000 Received: from CY1PR03MB2345.namprd03.prod.outlook.com ([10.166.207.144]) by CY1PR03MB2345.namprd03.prod.outlook.com ([10.166.207.144]) with mapi id 15.01.0771.011; Fri, 9 Dec 2016 16:32:41 +0000 From: Kurt Kennett To: "Yao, Jiewen" , "afish@apple.com" CC: "Bi, Dandan" , "edk2-devel@lists.01.org" , "Ni, Ruiyu" Thread-Topic: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after declaration Thread-Index: AQHSUUGEv7dYXu5p+0mZLsjiSWUaf6D+TfQwgABqC0CAAArK4IAAA2eAgAAA7QCAAQn6IA== Date: Fri, 9 Dec 2016 16:32:40 +0000 Message-ID: References: <1481194467-75920-1-git-send-email-dandan.bi@intel.com> <1481194467-75920-3-git-send-email-dandan.bi@intel.com> <74D8A39837DF1E4DA445A8C0B3885C50386F23F1@SHSMSX104.ccr.corp.intel.com> <74D8A39837DF1E4DA445A8C0B3885C50386F44DD@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <74D8A39837DF1E4DA445A8C0B3885C50386F44DD@SHSMSX104.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Kurt.Kennett@microsoft.com; x-originating-ip: [2001:4898:80e8:d::5f4] x-ms-office365-filtering-correlation-id: 16714ebe-c259-4e30-2ba2-08d42050feea x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY1PR03MB2348; x-microsoft-exchange-diagnostics: 1; CY1PR03MB2348; 7:1lOolCrdebWm/iw7XQja2w+Ox326zUixoEcGSHDyrtP1Qy8JzVd/L1oTEzU0E2S6PeiEx4UVNdpWG9p8Dfy2aeRvHIAmh9PXeqxmV2if+LVpYRTuH4Aa+9LFTik1iIEICfG0CZunZzH5OUovtE/GS8oslgEDqnn65CEKztqvSv5DjU5m7BrMG5AW1nrxOHjcNm7uxg8Fjztatvyxix+McVSVcveWMBis07tenz0wGImb2mDHO3JPJHid+s9WLNRfucgGWx4Zdw3ILpCkLvY8+Wmu/sIdA1UrE4yuSEZ7irNexnL3PHbptAc9QXFpLuk1fMLbneiX+kVr4UQF1xdKmPmgSK8aVjVa5Ep7LhHTj0iL6Zx5nGUAlIjJ9LZA+r3RtOCdkliGXS+W4ZAI8tq7UR1XSREJwcJWW0rFSHJlPD3RDUnL2RAVwdT0b6AufH3XqkqoE+Tz7552+rljzGM3zY5zsPtZ6KGhLCN4xLcrUBg= x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(162533806227266)(21748063052155)(31960201722614)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(61425038)(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041248)(20161123555025)(20161123564025)(20161123562025)(20161123560025)(6042181)(6072148)(6047074); SRVR:CY1PR03MB2348; BCL:0; PCL:0; RULEID:; SRVR:CY1PR03MB2348; x-forefront-prvs: 015114592F x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(7916002)(24454002)(13464003)(377454003)(189002)(199003)(69234005)(38730400001)(122556002)(2950100002)(2501003)(5001770100001)(50986999)(101416001)(97736004)(6506006)(76176999)(54356999)(77096006)(92566002)(106116001)(7696004)(10090500001)(105586002)(106356001)(99286002)(3280700002)(10290500002)(5005710100001)(229853002)(9686002)(8990500004)(81166006)(81156014)(8676002)(8936002)(74316002)(7906003)(86362001)(33656002)(606005)(5660300001)(7736002)(6116002)(790700001)(102836003)(68736007)(6436002)(93886004)(2906002)(76576001)(4326007)(2900100001)(86612001)(189998001)(8666005)(3660700001)(7059030); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR03MB2348; H:CY1PR03MB2345.namprd03.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Dec 2016 16:32:40.9652 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR03MB2348 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: Re: [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after declaration X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2016 16:32:43 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable No. Try "static const" K2 From: Yao, Jiewen [mailto:jiewen.yao@intel.com] Sent: Thursday, December 8, 2016 4:40 PM To: afish@apple.com; Kurt Kennett Cc: Bi, Dandan ; edk2-devel@lists.01.org; Ni, Ruiyu Subject: RE: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable = after declaration Hi I found it is using "STATIC" not "CONST". Does a compiler put "STATIC" data to READ-ONLY section? Thank you Yao Jiewen From: afish@apple.com [mailto:afish@apple.com] Sent: Friday, December 9, 2016 8:37 AM To: Kurt Kennett > Cc: Yao, Jiewen >; Bi, Da= ndan >; edk2-devel@lists.01= .org; Ni, Ruiyu > Subject: Re: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable = after declaration > On Dec 8, 2016, at 4:26 PM, Kurt Kennett > wrote: > > Is the data 'variable'? i.e does it ever change? > > A normal compiler should put this data into a section marked read-only if= it is marked as const, and a loader could read-protect the region after lo= ad. > K2, Did you mean write-protoect? FYI in my example in this thread from a macOS clang compiler the constant d= ate ends up in a const TEXT section, as the text section in general is cons= t. That is why the compiler emitted a PC relative access. This only ever be= comes an issue when hand writing assemble code for X64. Thanks, Andrew Fish > K2 > > -----Original Message----- > From: Yao, Jiewen [mailto:jiewen.yao@intel.com] > Sent: Thursday, December 8, 2016 3:47 PM > To: Kurt Kennett >; Bi, Dandan >; edk2= -devel@lists.01.org > Cc: Ni, Ruiyu > > Subject: RE: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variabl= e after declaration > > Agree. Maybe we can move it to be a global variable ? > > Thank you > Yao Jiewen > >> -----Original Message----- >> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of >> Kurt Kennett >> Sent: Friday, December 9, 2016 1:28 AM >> To: Bi, Dandan >; edk2-d= evel@lists.01.org >> Cc: Ni, Ruiyu > >> Subject: Re: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize >> variable after declaration >> >> This seems kind of silly. >> Why isn't this just const data? This adds code and memory accesses >> that are worthless and happen on every call to the function. >> >> K2 >> >> -----Original Message----- >> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of >> Dandan Bi >> Sent: Thursday, December 8, 2016 2:54 AM >> To: edk2-devel@lists.01.org >> Cc: Ruiyu Ni > >> Subject: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable >> after declaration >> >> Cc: Ruiyu Ni > >> Contributed-under: TianoCore Contribution Agreement 1.0 >> Signed-off-by: Dandan Bi > >> --- >> FatPkg/EnhancedFatDxe/Misc.c | 14 +++++++++++++- >> 1 file changed, 13 insertions(+), 1 deletion(-) >> >> diff --git a/FatPkg/EnhancedFatDxe/Misc.c >> b/FatPkg/EnhancedFatDxe/Misc.c index f91759c..6ad688c 100644 >> --- a/FatPkg/EnhancedFatDxe/Misc.c >> +++ b/FatPkg/EnhancedFatDxe/Misc.c >> @@ -696,15 +696,27 @@ Returns: >> TRUE - The time is valid. >> FALSE - The time is not valid. >> >> --*/ >> { >> - static UINT8 MonthDays[] =3D { 31, 28, 31, 30, 31, 30, 31, 31, 30, >> 31, 30, 31 }; >> + STATIC UINT8 MonthDays[12]; >> UINTN Day; >> BOOLEAN ValidTime; >> >> ValidTime =3D TRUE; >> + MonthDays[0] =3D 31; >> + MonthDays[1] =3D 28; >> + MonthDays[2] =3D 31; >> + MonthDays[3] =3D 30; >> + MonthDays[4] =3D 31; >> + MonthDays[5] =3D 30; >> + MonthDays[6] =3D 31; >> + MonthDays[7] =3D 31; >> + MonthDays[8] =3D 30; >> + MonthDays[9] =3D 31; >> + MonthDays[10] =3D 30; >> + MonthDays[11] =3D 31; >> >> // >> // Check the fields for range problems >> // Fat can only support from 1980 >> // >> -- >> 1.9.5.msysgit.1 >> >> _______________________________________________ >> edk2-devel mailing list >> edk2-devel@lists.01.org >> https://lists.01.org/mailman/listinfo/edk2-devel >> _______________________________________________ >> edk2-devel mailing list >> edk2-devel@lists.01.org >> https://lists.01.org/mailman/listinfo/edk2-devel > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel