From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-in2.apple.com (mail-out2.apple.com [17.151.62.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6BA1A81F6F for ; Thu, 8 Dec 2016 16:37:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; d=apple.com; s=mailout2048s; c=relaxed/simple; q=dns/txt; i=@apple.com; t=1481243837; h=From:Sender:Reply-To:Subject:Date:Message-id:To:Cc:MIME-version:Content-type: Content-transfer-encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-reply-to:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=XV0e302w2v4KCLlCtsbWeg791Zy2g6scS42YJhiHfwo=; b=Wy1/NAT1DqLdA0IpBw1brlhyBl9nc6GW8b2iy8OiErXtzzqKaIGLRLPLkZPl0Qx0 uQ9JGBCZrx5blayfn1ANy0t2augyBudkDA0TZMysu6PStlVhEneXZgbWUobxGBeA gh6GDY/4mUpguPLjl2WI1/KeaRAPi3ZjWscm4k0nxprB6F8M5jDMQKqF+CR+z+Fu b/XoqHLUunX9Ir1WyDnxbOx9/+xwEeSqNCH2z4tcWqt+xLZFh1vrCJ2Z39gs0sjQ 4vtLz2tg765Vmv8OntB11NRoP4ja1MFFRXz92w3++shR9SRv9CC52oOD1s65yaw9 vKc+3i1U9wPUxNS+5Gc32w==; Received: from relay6.apple.com (relay6.apple.com [17.128.113.90]) by mail-in2.apple.com (Apple Secure Mail Relay) with SMTP id 40.59.19960.CBCF9485; Thu, 8 Dec 2016 16:37:16 -0800 (PST) X-AuditID: 11973e11-a8f129a000004df8-9a-5849fcbc4a63 Received: from nwk-mmpp-sz07.apple.com (nwk-mmpp-sz07.apple.com [17.128.115.240]) by relay6.apple.com (Apple SCV relay) with SMTP id B9.EA.23613.CBCF9485; Thu, 8 Dec 2016 16:37:16 -0800 (PST) MIME-version: 1.0 Received: from [17.153.30.31] by nwk-mmpp-sz07.apple.com (Oracle Communications Messaging Server 8.0.1.1.0 64bit (built Jun 15 2016)) with ESMTPSA id <0OHW00EC371OKDD0@nwk-mmpp-sz07.apple.com>; Thu, 08 Dec 2016 16:37:01 -0800 (PST) Sender: afish@apple.com From: Andrew Fish In-reply-to: Date: Thu, 08 Dec 2016 16:36:59 -0800 Cc: "Yao, Jiewen" , "Bi, Dandan" , "edk2-devel@lists.01.org" , "Ni, Ruiyu" 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> To: Kurt Kennett X-Mailer: Apple Mail (2.3226) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrJLMWRmVeSWpSXmKPExsUi2FAYpbvnj2eEwa/NNhZbt6lb7Dl0lNli 3UcPi0nLLSxe9qxmd2D1WLznJZNH9+x/LB6tO/6yBzBHcdmkpOZklqUW6dslcGXs3SldcFG2 ounCOqYGxrviXYycHBICJhKX/vewdjFycQgJ7GWUmLpzOStMoqVrGQtE4hCjxPdVb5lAErwC ghI/Jt8DSnBwMAvISxw8LwsSZhbQkvj+qBWq/i2jxLSLd8HqhQXEJd6d2cQMUi8sECfR90wF JMwmoCyxYv4HdpAwp0C8xIauepAwi4CqxKXlS9hAxjALLGeUuNH3GmqtjcT6R42MUPOZJM7c WcMK0iwioCuxscsYxJQQkJWY/csLpERC4ASbxN9bK9kmMArPQnL1LISrZyG5egEj8ypGodzE zBzdzDwjvcSCgpxUveT83E2MoLCfbie4g/H4KqtDjAIcjEo8vAcKPCOEWBPLiitzDzFKc7Ao ifPGfQEKCaQnlqRmp6YWpBbFF5XmpBYfYmTi4JRqYLTQLX1jLRX8Nsm+4OuXF7Eb1y9af2uT qkeoZJbl69pPWVd+qWet77zwpfZEMWceX8/Exi/C31Jat68NlT4X5uGqJXMy1tH8WJ4L/8VH p5pj48I834gK/Dx7xk7x75pHk5jYNto3XLGVU7tWve3dwurD2U7Rhzc8cNohv+pzcvmqfa2z j7qsmqLEUpyRaKjFXFScCAAqPLArXAIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprAIsWRmVeSWpSXmKPExsUi2FD8QXfPH88Ig60LzSy2blO32HPoKLPF uo8eFpOWW1i87FnN7sDqsXjPSyaP7tn/WDxad/xlD2CO4rJJSc3JLEst0rdL4MrYu1O64KJs RdOFdUwNjHfFuxg5OSQETCRaupaxQNhiEhfurWfrYuTiEBI4xCjxfdVbJpAEr4CgxI/J94CK ODiYBeQlDp6XBQkzC2hJfH/UygJR/5ZRYtrFu2D1wgLiEu/ObGIGqRcWiJPoe6YCEmYTUJZY Mf8DO0iYUyBeYkNXPUiYRUBV4tLyJWBrmQWWM0rc6HsNtdZGYv2jRkao+UwSZ+6sYQVpFhHQ ldjYZQxiSgjISsz+5TWBUXAWkkNnIRw6C8mhCxiZVzEKFKXmJFaa6SUWFOSk6iXn525iBIdv YdQOxoblVocYBTgYlXh4DxR4RgixJpYVV+YCQ4KDWUmEN/M3UIg3JbGyKrUoP76oNCe1+BBj MtD9E5mlRJPzgbGVVxJvaGJiYGJsbGZsbG5iTpqwkjhv0kKPCCGB9MSS1OzU1ILUIpgtTByc Ug2MhVoiG0QKmPbNfemyQnZqxdfV3b17vpTvP68/eZnVl+2PGKVT7Nd8bjIu8Uj8lrJRM/qO irRR4WuL7ztOdc82jXi7N+14+I+8VaW3lstK5yydMuFUSNHGzhZrppWe8ma/i6dznxMQqqxp /m9gF5uecf7maiO/JrsLjKcOvw+xyD56vk8s8o2ZEktxRqKhFnNRcSIAD05biaMCAAA= 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 00:37:17 -0000 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII > 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 load. > K2, Did you mean write-protoect? FYI in my example in this thread from a macOS clang compiler the constant date ends up in a const TEXT section, as the text section in general is const. That is why the compiler emitted a PC relative access. This only ever becomes 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 variable 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-devel@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[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, >> 31, 30, 31 }; >> + STATIC UINT8 MonthDays[12]; >> UINTN Day; >> BOOLEAN ValidTime; >> >> ValidTime = TRUE; >> + MonthDays[0] = 31; >> + MonthDays[1] = 28; >> + MonthDays[2] = 31; >> + MonthDays[3] = 30; >> + MonthDays[4] = 31; >> + MonthDays[5] = 30; >> + MonthDays[6] = 31; >> + MonthDays[7] = 31; >> + MonthDays[8] = 30; >> + MonthDays[9] = 31; >> + MonthDays[10] = 30; >> + MonthDays[11] = 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