From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=98.137.65.204; helo=sonic311-23.consmr.mail.gq1.yahoo.com; envelope-from=nruslan_devel@yahoo.com; receiver=edk2-devel@lists.01.org Received: from sonic311-23.consmr.mail.gq1.yahoo.com (sonic311-23.consmr.mail.gq1.yahoo.com [98.137.65.204]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 039EF21E0B9F2 for ; Sat, 10 Feb 2018 16:42:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1518310095; bh=Y6qRktxaApYKj1daSUWuGuGm/3doW7fTlj94FcqoyH4=; h=Date:From:Reply-To:To:In-Reply-To:References:Subject:From:Subject; b=kvTHw/cMjev2an/qHpTcOzo4asUXQDcgoIGa+ztDZpnv/nK/56HcNqRbpl6UF1WOiJIdEa0mQWA9grEYgVKPfA/depr8Tv7Xy3QjO0x6gDCr2I3aCZGu/b2kzwFBcrL9+kFb/6e5XSNmEhX2Kw8OnAodB+yBjy/b2IEA2NVdAVUoyoItapS6Eq526peNa6o/nzWZ3VDr8DhrPev/V37st4c6pWEecFOfZz56x6ylt9n6tU269CG1GohTamX3FahK0mvKG8cSVEz0SNe1kC8RH5Tmz3xzSzEmuwVfXIAf6apzyuX3Rz0Vbm2Ug7sB9JioZo9YmJ18ZQkAVIHwv80kKw== X-YMail-OSG: qTNU5bwVM1m.1lnICgyWiKJjcL48LKGuFq00h.t6lUuJj80PPNrG6Uhjxd0JMFC aYb.gWo00dWT18r41sVt.AML1F5v4jxRz0OLox_nLJSkzd_1M_H8xjIxoCBEddIvI9moXZXQiDfr 0Ov60_mlT8D3zNDKsKsjNJlb2DoYVYcMNMz7XFMI7WB6DlL6MWvfsh4tHFpGdObiy8dfn7gIdqid 83sU.pd0UVqre2bZLs8wNt5WbAgeLrCVc39NPm.TDMK1IUMk7BUrG80jMhOJPkzl2eOxCuQrEzdo 7e4lVwEu_ikghdJjdIgKEUYNfL.1pzkzNR0RZPXOBH_LMLB0xqDcJrMYylm7JNUp0u_1e5nP0uw0 l0O4yl.Mofg4Nnz5rlv1RZMUzqVnhsrCVinp7uA9EDuPv6sIeps3hsHwp84TIkdCJz3IhFpcPJpq 0hpbnbwWKYCPdixZxStBtPFaugKKYmI4SpF3OJYBjqUZX7buSzuvCZC5t2Ho.zcyKpIc8tg-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.gq1.yahoo.com with HTTP; Sun, 11 Feb 2018 00:48:15 +0000 Date: Sun, 11 Feb 2018 00:48:11 +0000 (UTC) From: Ruslan Nikolaev Reply-To: Ruslan Nikolaev To: "edk2-devel@lists.01.org" Message-ID: <799870052.5558634.1518310091632@mail.yahoo.com> In-Reply-To: <2075235543.4680791.1518163989435@mail.yahoo.com> References: <774033816.4534639.1518139941905.ref@mail.yahoo.com> <774033816.4534639.1518139941905@mail.yahoo.com> <339D4678-56CB-4195-AD81-9AE7D0CA2B13@apple.com> <113792737.4648564.1518159755787@mail.yahoo.com> <409605137.4680848.1518160327442@mail.yahoo.com> <29D926A0-3F6B-47AB-AE2E-BE2F256EA8A0@apple.com> <2075235543.4680791.1518163989435@mail.yahoo.com> MIME-Version: 1.0 X-Mailer: WebService/1.1.11316 YahooMailNeo Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/64.0.3282.140 Chrome/64.0.3282.140 Safari/537.36 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 Subject: Re: Patch to fix EFIAPI definition X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Feb 2018 00:42:28 -0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Andrew, Is there any update on this issue? Ruslan=20 On Friday, February 9, 2018 3:13 AM, Ruslan Nikolaev wrote: =20 Sorry, I did not answer this question last time. It is basically may not = be very easy to change if you already have some assembly code which makes u= se of a specific calling convention. Plus there may be benefits of using re= gister-based calls elsewhere. I thought, since EFIAPI aims to define a specific calling convention regar= dless of compilation flags, why not specify regparm(0) there as well.=20 On Friday, February 9, 2018 2:17 AM, Andrew Fish wro= te: =20 =20 > On Feb 8, 2018, at 11:12 PM, Ruslan Nikolaev w= rote: >=20 > Well, what I was implying is that if MdePkg (Ia32) headers are included = in some UEFI program which itself is compiled with some custom register-bas= ed calling convention, current EFIAPI definition is insufficient. > Current definition with cdecl attribute merely forces caller stack clean= -up in gcc/clang for Ia32 > So, if I build with '-mrtd' option (a callee cleans up the stack) curren= t EFIAPI definition will take care of it. However, if in addition to that I= specify -mregparm=3D1,2,3 to pass some parameters in registers, cdecl will= not take care of it. > EFIAPI for Ia32 wants all parameters in the stack. Therefore, it should = be reasonable to specify regparm(0) as part of EFIAPI definition as well, s= o that regardless of mregparm parameter the compiler will generate correct = code.=20 >=20 Ruslan, Thanks for the info. I guess I still have the question of if you are makin= g firmware why not solve this problem with compiler flags in the 1st place.= = =20 Thanks, Andrew Fish >=20 >=C2=A0 =C2=A0 On Friday, February 9, 2018 1:59 AM, Andrew Fish wrote: >=20 >=20 >=20 >=20 > On Feb 8, 2018, at 5:32 PM, Ruslan Nikolaev wr= ote: > I submitted a bug report and a patch: https://bugzilla.tianocore.org/sho= w_bug.cgi?id=3D870 > It is very straight-forward. Can someone review it, and, hopefully, comm= it the change? >=20 >=20 > Ruslan, > Was there an example of how to code this? Sorry if I missed it, I'm gett= ing a lot of email these days. > Also what is you usage model? Clang is very cross compiler friendly and = you can specify a triple to support the ABI you need. To get EFI supported = on macOS tools we ended up open sourcing a triple to support the EFIAPI. If= you look in https://github.com/tianocore/edk2/blob/master/BaseTools/Conf/t= ools_def.template you will see that you can use Xcode to build EFIAPI if yo= u pass -target x86_64-pc-win32-macho.=20 > I guess I'm asking the question if you really need to support multiple A= BIs with clang? The best way to solve this in clang is to make it support E= FIAPI. If you don't need multiple ABIs take a look at what we did with -tar= get x86_64-pc-win32-macho, which tells clang to build EFIABI, but output a = mach-O executable (we need the mach-O for our debugger). Basically with cla= ng you could upstream what you need into the compiler you are using for oth= er things... > Thanks, > Andrew Fish >=20 > - Ruslan > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel >=20 >=20 >=20 >=20 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel =20 =20 >>From david.wei@intel.com Sat Feb 10 18:23:00 2018 Return-Path: X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity