mirror of
https://github.com/ipxe/ipxe
synced 2025-12-06 17:30:26 +03:00
[efi] Switch back to VA_START() etc macros for EFIAPI functions
Commit 670810b ("[efi] Use standard va_args macros instead of
VA_START() etc") fixed a 32-bit RISC-V build error, but broke the
functionality of the InstallMultipleProtocolInterfaces() and
UninstallMultipleProtocolInterfaces() wrapper functions. GCC does not
automatically check the ABI of the current function when using the
__builtin_va_start() and related macros, and it is therefore necessary
for code to use __builtin_ms_va_start() etc from within functions
marked as EFIAPI.
Since commit 9016f2e ("[efi] Skip including the EDK2 ProcessorBind.h
header for 32-bit RISC-V") has now fixed the original 32-bit RISC-V
build error, we can switch back to using the EDK2 VA_START() etc
macros to obtain the correct behaviour.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -1082,7 +1082,7 @@ efi_install_multiple_protocol_interfaces_wrapper ( EFI_HANDLE *handle, ... ) {
|
||||
void *retaddr = __builtin_return_address ( 0 );
|
||||
EFI_GUID *protocol[ MAX_WRAP_MULTI + 1 ];
|
||||
VOID *interface[MAX_WRAP_MULTI];
|
||||
va_list ap;
|
||||
VA_LIST ap;
|
||||
unsigned int i;
|
||||
EFI_STATUS efirc;
|
||||
|
||||
@@ -1090,20 +1090,20 @@ efi_install_multiple_protocol_interfaces_wrapper ( EFI_HANDLE *handle, ... ) {
|
||||
efi_handle_name ( *handle ) );
|
||||
memset ( protocol, 0, sizeof ( protocol ) );
|
||||
memset ( interface, 0, sizeof ( interface ) );
|
||||
va_start ( ap, handle );
|
||||
for ( i = 0 ; ( protocol[i] = va_arg ( ap, EFI_GUID * ) ) ; i++ ) {
|
||||
VA_START ( ap, handle );
|
||||
for ( i = 0 ; ( protocol[i] = VA_ARG ( ap, EFI_GUID * ) ) ; i++ ) {
|
||||
if ( i == MAX_WRAP_MULTI ) {
|
||||
va_end ( ap );
|
||||
VA_END ( ap );
|
||||
efirc = EFI_OUT_OF_RESOURCES;
|
||||
DBGC ( colour, "<FATAL: too many arguments> ) = %s "
|
||||
"-> %p\n", efi_status ( efirc ), retaddr );
|
||||
return efirc;
|
||||
}
|
||||
interface[i] = va_arg ( ap, VOID * );
|
||||
interface[i] = VA_ARG ( ap, VOID * );
|
||||
DBGC ( colour, ", %s, %p",
|
||||
efi_guid_ntoa ( protocol[i] ), interface[i] );
|
||||
}
|
||||
va_end ( ap );
|
||||
VA_END ( ap );
|
||||
DBGC ( colour, " ) " );
|
||||
efirc = bs->InstallMultipleProtocolInterfaces ( handle,
|
||||
protocol[0], interface[0], protocol[1], interface[1],
|
||||
@@ -1132,7 +1132,7 @@ efi_uninstall_multiple_protocol_interfaces_wrapper ( EFI_HANDLE handle, ... ) {
|
||||
void *retaddr = __builtin_return_address ( 0 );
|
||||
EFI_GUID *protocol[ MAX_WRAP_MULTI + 1 ];
|
||||
VOID *interface[MAX_WRAP_MULTI];
|
||||
va_list ap;
|
||||
VA_LIST ap;
|
||||
unsigned int i;
|
||||
EFI_STATUS efirc;
|
||||
|
||||
@@ -1140,20 +1140,20 @@ efi_uninstall_multiple_protocol_interfaces_wrapper ( EFI_HANDLE handle, ... ) {
|
||||
efi_handle_name ( handle ) );
|
||||
memset ( protocol, 0, sizeof ( protocol ) );
|
||||
memset ( interface, 0, sizeof ( interface ) );
|
||||
va_start ( ap, handle );
|
||||
for ( i = 0 ; ( protocol[i] = va_arg ( ap, EFI_GUID * ) ) ; i++ ) {
|
||||
VA_START ( ap, handle );
|
||||
for ( i = 0 ; ( protocol[i] = VA_ARG ( ap, EFI_GUID * ) ) ; i++ ) {
|
||||
if ( i == MAX_WRAP_MULTI ) {
|
||||
va_end ( ap );
|
||||
VA_END ( ap );
|
||||
efirc = EFI_OUT_OF_RESOURCES;
|
||||
DBGC ( colour, "<FATAL: too many arguments> ) = %s "
|
||||
"-> %p\n", efi_status ( efirc ), retaddr );
|
||||
return efirc;
|
||||
}
|
||||
interface[i] = va_arg ( ap, VOID * );
|
||||
interface[i] = VA_ARG ( ap, VOID * );
|
||||
DBGC ( colour, ", %s, %p",
|
||||
efi_guid_ntoa ( protocol[i] ), interface[i] );
|
||||
}
|
||||
va_end ( ap );
|
||||
VA_END ( ap );
|
||||
DBGC ( colour, " ) " );
|
||||
efirc = bs->UninstallMultipleProtocolInterfaces ( handle,
|
||||
protocol[0], interface[0], protocol[1], interface[1],
|
||||
|
||||
Reference in New Issue
Block a user