From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=98.137.68.32; helo=sonic308-8.consmr.mail.gq1.yahoo.com; envelope-from=nruslan_devel@yahoo.com; receiver=edk2-devel@lists.01.org Received: from sonic308-8.consmr.mail.gq1.yahoo.com (sonic308-8.consmr.mail.gq1.yahoo.com [98.137.68.32]) (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 28DF3222DE140 for ; Fri, 9 Feb 2018 00:07:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1518163997; bh=pJ+Az/8Nj1AJSjdZsg/z+0YcWYB2xv1iZnbfVffvrbo=; h=Date:From:Reply-To:To:In-Reply-To:References:Subject:From:Subject; b=OQ5FtAChY6EkFgN+tWD3GE62DBmluZwdw2KANHfRvmAJ6AZc2nZZDJOOC2Z1+8n0GvFqhDyx4QQfmoK3y/SFxbnaVxARrJDigH3JxxrO18i5Idp8S64V0y/Ufb6sgy4lJxsh0sfPMOGjdQ1P7Vbzsi2ktmzsTixIMMR9g1PNM77W4nvAGCP3C5f6q7hed5GIxiRYlthG97jWPU7b83IXjUcg6YzIwmKihquLzch8bTWjoalv6QOustbCK8HAnkAQ3kozqw/bwNtQCXUKjEf6mxqZj4rS8c4x8qAt4RdEVaP7OvxXbdeKMzH2WEhuxMntSnvTxeh2fOTq1PhMHstqlA== X-YMail-OSG: 1oYtOPgVM1mTv3iSYCvo7mlpCzVITzfdEB8vGNZyXeaUqij6qNBFlKlreAUmzzo jbMvxVhnms8oZh9jMQv93s6gy9Tswd2.4thjNxV3r9Id4.Lx4Iwfad0iQalqn7HT_Rr9KHAL1G.I lNvYWt1tAeNgBQzqCYN9TP5xdHocWxY0_4FSbJ4fqLB0C2xoSz7LiuZXS4ggqPq2st5SW9apGa8G Qq1a4XtcM010F97rkhxLtWkd3bPYBWR6h51Zdj9vmuClbe3Ila3FHNWLQmi0WVuxHLmDEI6XGCHU 9R6LgrHk4a1rCwYpYS0nCh3uKyqC0505DD.WIMUj.3SWjm.KXGVWu8ADShqFW.R8JbOz4zpSxJi. Pdk7nt9CTE4WJ6RAOqHLEKMXe8_hkzh47DUs1QFWV6aWkz40oG2Q6EfVtsPOE_iAr9fiunoC1eeo M.vqJ6_UMV9ifxw3_QNyLwmmKoCHXd.TzQM7J6DZncHp.06vswQEX5uyEM1ZwiA13rg-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic308.consmr.mail.gq1.yahoo.com with HTTP; Fri, 9 Feb 2018 08:13:17 +0000 Date: Fri, 9 Feb 2018 08:13:09 +0000 (UTC) From: Ruslan Nikolaev Reply-To: Ruslan Nikolaev To: "edk2-devel@lists.01.org" Message-ID: <2075235543.4680791.1518163989435@mail.yahoo.com> In-Reply-To: <29D926A0-3F6B-47AB-AE2E-BE2F256EA8A0@apple.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> MIME-Version: 1.0 X-Mailer: WebService/1.1.11316 YahooMailNeo Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0 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: Fri, 09 Feb 2018 08:07:34 -0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 use= of a specific calling convention. Plus there may be benefits of using regi= ster-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 >>From star.zeng@intel.com Fri Feb 9 00:24:52 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