From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=209.132.183.28; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (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 D5DE821195BD0 for ; Fri, 7 Dec 2018 05:07:02 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 85450308A959; Fri, 7 Dec 2018 13:07:01 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-122-123.rdu2.redhat.com [10.10.122.123]) by smtp.corp.redhat.com (Postfix) with ESMTP id A64D079D66; Fri, 7 Dec 2018 13:07:00 +0000 (UTC) To: Peter Wiehe References: <201812061446.52228.wpaul@windriver.com> From: Laszlo Ersek Cc: Bill Paul , edk2-devel@lists.01.org Message-ID: Date: Fri, 7 Dec 2018 14:06:59 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <201812061446.52228.wpaul@windriver.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Fri, 07 Dec 2018 13:07:01 +0000 (UTC) Subject: Re: edk2 and gnu-efi calling schemes X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Dec 2018 13:07:03 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 12/06/18 23:46, Bill Paul wrote: > Of all the gin joints in all the towns in all the world, Peter Wiehe had to > walk into mine at 14:34 on Thursday 06 December 2018 and say: > >> OK, another question: >> >> when writing an UEFI application, edk2 and gnu-efi have different 64bit >> calling schemes. Does that only apply to calling the >> runtime-library/object file (and inside of the UEFI-application, of >> course)? Or does the call from application to UEFI differ in both >> toolkits, too? (If it is the latter, it would mean that the UEFI >> standard is unprecise!) > > Both the EDK and GNU EFI obey the same standards when calling UEFI APIs. Their > exact implementations may differ depending on the circumstances. For example, > GNU EFI may use the __attribute__((ms_abi)) tag to tell the compiler what ABI > to use, or if the compiler doesn't support this it can fall back to using some > compatibility wrapper macros (see lib/x86_64/efi_stub.S). Either way, you end > up with the same behavior. > > Within a given FOO.EFI application, the application code itself can get away > with using whatever calling convention it wants, right up until it needs to > call a UEFI firmware routine. At that point, it has to follow the conventions > spelled out in the UEFI spec. I'd like to add: - in edk2, functions declared in lib class headers have to be EFIAPI; - functions that take variable arguments must be EFIAPI, even if they are STATIC (long story). Thanks Laszlo