From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=40.92.68.90; helo=eur02-he1-obe.outbound.protection.outlook.com; envelope-from=marvin.haeuser@outlook.com; receiver=edk2-devel@lists.01.org Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-oln040092068090.outbound.protection.outlook.com [40.92.68.90]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7B874203B85B4 for ; Tue, 8 May 2018 17:21:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=TpJ47DEwn4ufOrHEX+1hy6fPLSXx1jjxF5szvLTpwHA=; b=bACTs45+/+rfNOR1nynIOI6/n3taM1yqy5itKaXKD9pS4uiWCud5YdWCLHKFnardYmMOzWpMIHQpp3XEhTLNsd50D3KRD3RFZ/kt00Iyn+UL1UdlUgFEuS5CwhLXxWBoV2ojAzQjTQoKmeru5svI8VspPOrCYJiRo6NOFv4voJRubVDyvYhrgBTUudLjI6ZpmXd/lBa5wp/rxTTuPRfUi8ffZlt5es6mIx+mZa5r/EFjkBWp5QVlvdqLZIu0ix5PmFyr7PeJ8+SQzAvuQIpN4cHvnXmIYjOd3F9k90Lk/tqSMV86O9jg/b34Cz76NOq61t7ezv2ptoQ5blB3z96HUg== Received: from HE1EUR02FT035.eop-EUR02.prod.protection.outlook.com (10.152.10.51) by HE1EUR02HT013.eop-EUR02.prod.protection.outlook.com (10.152.10.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.735.16; Wed, 9 May 2018 00:21:14 +0000 Received: from VI1PR0801MB1790.eurprd08.prod.outlook.com (10.152.10.58) by HE1EUR02FT035.mail.protection.outlook.com (10.152.10.127) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.20.735.16 via Frontend Transport; Wed, 9 May 2018 00:21:14 +0000 Received: from VI1PR0801MB1790.eurprd08.prod.outlook.com ([fe80::7c79:584b:2e12:783e]) by VI1PR0801MB1790.eurprd08.prod.outlook.com ([fe80::7c79:584b:2e12:783e%17]) with mapi id 15.20.0755.012; Wed, 9 May 2018 00:21:14 +0000 From: =?iso-8859-1?Q?Marvin_H=E4user?= To: "edk2-devel@lists.01.org" CC: "Yao, Jiewen" Thread-Topic: [PATCH] MdePkg/BaseLib: Globally include ChkStk.c Thread-Index: AdPnJWlKcshriHOETXuZ755wb8JLiwAAiYkAAAAKWvAAALKYAAAABwWQ Date: Wed, 9 May 2018 00:21:14 +0000 Message-ID: References: <74D8A39837DF1E4DA445A8C0B3885C503AB98291@shsmsx102.ccr.corp.intel.com> <74D8A39837DF1E4DA445A8C0B3885C503AB98303@shsmsx102.ccr.corp.intel.com> In-Reply-To: <74D8A39837DF1E4DA445A8C0B3885C503AB98303@shsmsx102.ccr.corp.intel.com> Accept-Language: de-DE, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:ADD4F04B7347D8E6BA8E52BC4BAC3889E5C5F1FBFFCA3F8D032205C881455CD8; UpperCasedChecksum:5A040EE96E869795D1FAAB1EE7B1B1991DF3795DB9036AE691E8FC24F6958313; SizeAsReceived:7395; Count:46 x-tmn: [VIygli2LkP3d8D8VIXEfWdfX/cRwJbBJ] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; HE1EUR02HT013; 7:6GcWcRFWnfKooeLVBwl70iNaP8C2jzZASdmTQg0iag2IwqIlOciQrUBCa3k+EbY14rR1q6SPTNwZ3ha52G10xoHfBDzYWG0TRdMOrGXPJV5a1uvtnDCPThbquyEjee2eErNS8yNLDGMhCgykGkhk6unrgpB0wKPlCoDfeEUwaoF0EwZ/+b1YxjUGS0VImeEPT3BK61cTIqTrIkUEnEixmA5SF7d2MOCUT41b1DO9ftZ4W79UkMpOmvG9xwwtH6lm x-incomingheadercount: 46 x-eopattributedmessage: 0 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(201702061078)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031324274)(2017031323274)(2017031322404)(1601125420)(1603101448)(1701031045); SRVR:HE1EUR02HT013; x-ms-traffictypediagnostic: HE1EUR02HT013: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(444000031); SRVR:HE1EUR02HT013; BCL:0; PCL:0; RULEID:; SRVR:HE1EUR02HT013; x-forefront-prvs: 0667289FF8 x-forefront-antispam-report: SFV:NSPM; SFS:(7070007)(199004)(189003)(13464003)(6306002)(426003)(486006)(476003)(5250100002)(4326008)(6246003)(8936002)(86362001)(53376002)(68736007)(7696005)(81156014)(104016004)(105586002)(446003)(11346002)(55016002)(8676002)(72206003)(45080400002)(97736004)(76176011)(99286004)(6436002)(2501003)(25786009)(106356001)(966005)(229853002)(2351001)(6346003)(1720100001)(74316002)(14454004)(5640700003)(87572001)(305945005)(3660700001)(82202002)(59450400001)(102836004)(53546011)(26005)(6916009)(33656002)(93886005)(3280700002)(5660300001)(2900100001)(20460500001)(19627235001); DIR:OUT; SFP:1901; SCL:1; SRVR:HE1EUR02HT013; H:VI1PR0801MB1790.eurprd08.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:; received-spf: None (protection.outlook.com: outlook.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Marvin.Haeuser@outlook.com; x-microsoft-antispam-message-info: xQsBrYFSMXRlMaDDNwfHJG/9c+sK7HOHUq26REgP9fq2AEq978uJgeAqvYMuHacJOunQRv3SAf38XBVkz+w5/VU1/fvndwRdJm8Y3Xiq6iztAAUSJmc22TZVvINUrXzXuYKCDLRF5w9DEG3j0SUsFrzZp4qUJlZpHpnP7vyOHXZNByyjXWYnruScwLQC8JGd MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 51eb470c-37c9-4c56-bca4-08d5b542c648 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 7181d4b0-87d6-4f4e-ba33-0d3746212cec X-MS-Exchange-CrossTenant-Network-Message-Id: 51eb470c-37c9-4c56-bca4-08d5b542c648 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 7181d4b0-87d6-4f4e-ba33-0d3746212cec X-MS-Exchange-CrossTenant-originalarrivaltime: 09 May 2018 00:21:14.0980 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1EUR02HT013 Subject: Re: [PATCH] MdePkg/BaseLib: Globally include ChkStk.c X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2018 00:21:20 -0000 Content-Language: de-DE Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Oh, if you are prefering a good implementation, I will be all for that. Thi= s was just a 'quick workaround', same as currently done for GCC. I'm actually unsure whether a good implementation is possible with a flat m= emory model. It will likely be mere luck whether there is enough space free= below the stack, except for maybe when it's located very high (preferably = past the 32-bit space). Has there been any prior discussion on this topic? Would be interested to f= ollow up if there was. Thanks, Marvin > -----Original Message----- > From: Yao, Jiewen > Sent: Wednesday, May 9, 2018 2:13 AM > To: Marvin.Haeuser@outlook.com; edk2-devel@lists.01.org > Cc: Gao, Liming > Subject: RE: [PATCH] MdePkg/BaseLib: Globally include ChkStk.c >=20 > There are some open source implementation: > MSVC: https://github.com/ispc/ispc/issues/542 > GCC: > https://android.googlesource.com/toolchain/gcc/+/b094d6c4bf572654a031e > cc4afe675154c886dc5/gcc-4.4.3/gcc/config/i386/chkstk.asm >=20 > The compiler generated code assumes the stack is enlarged after we can > chkstk. >=20 > I agree empty function can make build pass. > But more important, we need make it work if there is a need to increase t= he > stack. > The potential issue is that the later code (after chkstk) assumes the sta= ck is > increased, but actually it is not. >=20 > That is why I ask how this is validated. >=20 > Thank you > Yao Jiewen >=20 >=20 > > -----Original Message----- > > From: Marvin H=E4user [mailto:Marvin.Haeuser@outlook.com] > > Sent: Tuesday, May 8, 2018 4:58 PM > > To: edk2-devel@lists.01.org > > Cc: Yao, Jiewen ; Gao, Liming > > > > Subject: RE: [PATCH] MdePkg/BaseLib: Globally include ChkStk.c > > > > Hey Yao, > > > > As far as I am aware, all __chkstk does is access the stack in 4 KB > > intervals from the current location to the maximum requested location > > to eventually hit the Windows Guard Page, which then triggers the stack > increase. > > Because I do not know of any equivalent concept in edk2 and the > > intrinsic was already disabled for GCC, I supposed it was a good idea > > to do so globally. Are the potential issues I am not aware of? > > > > Thanks, > > Marvin. > > > > > -----Original Message----- > > > From: Yao, Jiewen > > > Sent: Wednesday, May 9, 2018 1:52 AM > > > To: Marvin.Haeuser@outlook.com; edk2-devel@lists.01.org > > > Cc: Gao, Liming > > > Subject: RE: [PATCH] MdePkg/BaseLib: Globally include ChkStk.c > > > > > > HI Marvin > > > Would you mind to share the information on how you test this update? > > > > > > > > > Per my experience, chkstk not only does the check but also does the > > > real work to allocate more stack. > > > > > > /Gs can be used to indicate the size (/Gs[num] control stack > > > checking calls) > > > > > > We use /Gs32768 by default, see tools_def.txt. > > > > > > Usually, we just increase this value to override the default one, if > > > we hit this issue. > > > > > > Thank you > > > Yao Jiewen > > > > > > > -----Original Message----- > > > > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On > > > > Behalf Of Marvin H?user > > > > Sent: Tuesday, May 8, 2018 4:37 PM > > > > To: edk2-devel@lists.01.org > > > > Cc: Gao, Liming > > > > Subject: Re: [edk2] [PATCH] MdePkg/BaseLib: Globally include > > > > ChkStk.c > > > > > > > > Hey Liming, > > > > > > > > According to the MSDN documentation, the call will be inserted for > > > > a stack usage past a defined threshold - 4 KB for IA32, 8 KB for X6= 4 > (source: > > > > https://msdn.microsoft.com/en-us/library/ms648426(v=3Dvs.85).aspx). > > > > > > > > Thanks, > > > > Marvin > > > > > > > > > -----Urspr=FCngliche Nachricht----- > > > > > Von: Gao, Liming > > > > > Gesendet: Montag, 7. Mai 2018 14:16 > > > > > An: Marvin.Haeuser@outlook.com; edk2-devel@lists.01.org > > > > > Cc: Kinney, Michael D > > > > > Betreff: RE: [PATCH] MdePkg/BaseLib: Globally include ChkStk.c > > > > > > > > > > Marvin: > > > > > In VS compiler, what case will trig this intrinsic function? > > > > > > > > > > Thanks > > > > > Liming > > > > > > -----Original Message----- > > > > > > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On > > > > > > Behalf Of Marvin H?user > > > > > > Sent: Saturday, May 5, 2018 10:25 PM > > > > > > To: edk2-devel@lists.01.org > > > > > > Cc: Kinney, Michael D ; Gao, > > > > > > Liming > > > > > > Subject: [edk2] [PATCH] MdePkg/BaseLib: Globally include > > > > > > ChkStk.c > > > > > > > > > > > > Initially added for GCC build support, this patch includes the > > > > > > function for all compilers and all architectures. This is done > > > > > > as huge variables on the stack may cause the generation of > > > > > > calls to this intrinsic function for Microsoft compilers, even > > > > > > for the IA32 architecture, too. > > > > > > > > > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > > > > > Signed-off-by: Marvin Haeuser > > > > > > --- > > > > > > MdePkg/Library/BaseLib/{ChkStkGcc.c =3D> ChkStk.c} | 48 > > > > > > ++++++++++------ > > > > > ---- > > > > > > MdePkg/Library/BaseLib/BaseLib.inf | 4 +- > > > > > > 2 files changed, 26 insertions(+), 26 deletions(-) > > > > > > > > > > > > diff --git a/MdePkg/Library/BaseLib/ChkStkGcc.c > > > > > > b/MdePkg/Library/BaseLib/ChkStk.c similarity index 74% rename > > > > > > from MdePkg/Library/BaseLib/ChkStkGcc.c > > > > > > rename to MdePkg/Library/BaseLib/ChkStk.c index > > > > > > ecba3853b159..59e6d73f9331 100644 > > > > > > --- a/MdePkg/Library/BaseLib/ChkStkGcc.c > > > > > > +++ b/MdePkg/Library/BaseLib/ChkStk.c > > > > > > @@ -1,24 +1,24 @@ > > > > > > -/** @file > > > > > > - Provides hack function for passng GCC build. > > > > > > - > > > > > > - Copyright (c) 2006 - 2008, Intel Corporation. All rights > > > > > > reserved.
> > > > > > - This program and the accompanying materials > > > > > > - are licensed and made available under the terms and > > > > > > conditions of the BSD License > > > > > > - which accompanies this distribution. The full text of the > > > > > > license may be found at > > > > > > - http://opensource.org/licenses/bsd-license.php. > > > > > > - > > > > > > - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN > "AS > > > IS" > > > > > > BASIS, > > > > > > - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, > EITHER > > > > > EXPRESS OR IMPLIED. > > > > > > - > > > > > > -**/ > > > > > > - > > > > > > -#include "BaseLibInternals.h" > > > > > > - > > > > > > -/** > > > > > > - Hack function for passing GCC build. > > > > > > -**/ > > > > > > -VOID > > > > > > -__chkstk() > > > > > > -{ > > > > > > -} > > > > > > - > > > > > > +/** @file > > > > > > + Provides hack function for passing build. > > > > > > + > > > > > > + Copyright (c) 2006 - 2018, Intel Corporation. All rights > > > > > > + reserved.
This program and the accompanying materials > > > > > > + are licensed and made available under the terms and > > > > > > + conditions of the BSD License which accompanies this > > > > > > + distribution. The full text of the license may be found at > > > > > > + http://opensource.org/licenses/bsd- > > > > > license.php. > > > > > > + > > > > > > + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN > "AS > > > IS" > > > > > > + BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY > KIND, > > > > > EITHER EXPRESS OR IMPLIED. > > > > > > + > > > > > > +**/ > > > > > > + > > > > > > +#include "BaseLibInternals.h" > > > > > > + > > > > > > +/** > > > > > > + Hack function for passing build. > > > > > > +**/ > > > > > > +VOID > > > > > > +__chkstk() > > > > > > +{ > > > > > > +} > > > > > > + > > > > > > diff --git a/MdePkg/Library/BaseLib/BaseLib.inf > > > > > > b/MdePkg/Library/BaseLib/BaseLib.inf > > > > > > index 5fbbd02a94b6..d23a6db2581a 100644 > > > > > > --- a/MdePkg/Library/BaseLib/BaseLib.inf > > > > > > +++ b/MdePkg/Library/BaseLib/BaseLib.inf > > > > > > @@ -1,7 +1,7 @@ > > > > > > ## @file > > > > > > # Base Library implementation. > > > > > > # > > > > > > -# Copyright (c) 2007 - 2016, Intel Corporation. All rights > > > > > > reserved.
> > > > > > +# Copyright (c) 2007 - 2018, Intel Corporation. All rights > > > > > > +reserved.
> > > > > > # Portions copyright (c) 2008 - 2009, Apple Inc. All rights > > > > > > reserved.
# Portions copyright (c) 2011 - 2013, ARM Ltd. > > > > > > All rights reserved.
# @@ -64,6 +64,7 @@ [Sources] > > > > > > SafeString.c > > > > > > String.c > > > > > > FilePaths.c > > > > > > + ChkStk.c > > > > > > BaseLibInternals.h > > > > > > > > > > > > [Sources.Ia32] > > > > > > @@ -781,7 +782,6 @@ [Sources.X64] > > > > > > X64/DisableCache.S | GCC > > > > > > X64/RdRand.nasm| GCC > > > > > > X64/RdRand.S | GCC > > > > > > - ChkStkGcc.c | GCC > > > > > > > > > > > > [Sources.IPF] > > > > > > Ipf/AccessGp.s > > > > > > -- > > > > > > 2.17.0.windows.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