public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Peter Wiehe <peter.wiehe2@gmail.com>
Cc: Bill Paul <wpaul@windriver.com>, edk2-devel@lists.01.org
Subject: Re: edk2 and gnu-efi calling schemes
Date: Fri, 7 Dec 2018 14:06:59 +0100	[thread overview]
Message-ID: <f6df80cc-0603-41a3-9881-e408284cc750@redhat.com> (raw)
In-Reply-To: <201812061446.52228.wpaul@windriver.com>

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


  reply	other threads:[~2018-12-07 13:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-06 22:34 edk2 and gnu-efi calling schemes Peter Wiehe
2018-12-06 22:46 ` Bill Paul
2018-12-07 13:06   ` Laszlo Ersek [this message]
2018-12-07 13:26     ` Knop, Ryszard
2018-12-07 14:09       ` Laszlo Ersek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f6df80cc-0603-41a3-9881-e408284cc750@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox