[haiku-bugs] Re: [Haiku] #10800: UEFI: assembly files need to take calling convention into account

  • From: "tqh" <trac@xxxxxxxxxxxx>
  • Date: Thu, 01 May 2014 12:12:11 -0000

#10800: UEFI: assembly files need to take calling convention into account
---------------------------------+----------------------------
   Reporter:  jessicah           |      Owner:  axeld
       Type:  bug                |     Status:  new
   Priority:  normal             |  Milestone:  R1
  Component:  System/libroot.so  |    Version:  R1/Development
 Resolution:                     |   Keywords:
 Blocked By:                     |   Blocking:
Has a Patch:  0                  |   Platform:  All
---------------------------------+----------------------------

Comment (by tqh):

 When I looked into this I wanted MS calling conventions to be used for
 UEFI calls only. We set GNU_EFI_USE_MS_ABI and that makes HAVE_USE_MS_ABI
 1 to be set in efibind.h. So if we use MS calling conventions all the time
 I think we are doing something wrong. Note that if our main function,
 called from start_func.S isn't marked as EFIAPI we might need to fix the
 asm or mark it EFIAPI.

 So that might be worth investigating.

 See
 
https://github.com/tqh/haiku/blob/efi/headers/private/kernel/boot/platform/efi/arch/x86_64/efibind.h#L25
 {{{
 #if defined(GNU_EFI_USE_MS_ABI)
     #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 &&
 __GNUC_MINOR__ >= 7))
         #define HAVE_USE_MS_ABI 1
     #else
         #error Compiler is too old for GNU_EFI_USE_MS_ABI
     #endif
 #endif
 }}}

 
https://github.com/tqh/haiku/blob/efi/headers/private/kernel/boot/platform/efi/arch/x86_64/efibind.h#L183
 {{{
 #ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler
 options
     #ifdef _MSC_EXTENSIONS
         #define EFIAPI __cdecl // Force C calling convention for Microsoft
 C compiler
     #elif defined(HAVE_USE_MS_ABI)
         // Force amd64/ms calling conventions.
         #define EFIAPI __attribute__((ms_abi))
     #else
         #define EFIAPI // Substitute expresion to force C calling
 convention
     #endif
 #endif
 }}}

--
Ticket URL: <https://dev.haiku-os.org/ticket/10800#comment:6>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: