diff options
author | Michael Brown <mcb30@ipxe.org> | 2021-11-21 13:19:55 +0000 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2021-11-21 13:24:24 +0000 |
commit | 51612b6e69e049b6f08e833581815b4d0e9ffd39 (patch) | |
tree | f8d29c65ec6dae751cc148a3316dcd99bde200dc | |
parent | 236299baa32452c79a59138c44eca5fcf4a918f9 (diff) | |
download | ipxe-51612b6e69e049b6f08e833581815b4d0e9ffd39.tar.gz |
[efi] Do not attempt to use console output after ExitBootServices()
A successful call to ExitBootServices() will result in the EFI console
becoming unusable. Ensure that the EFI wrapper produces a complete
line of debug output before calling the wrapped ExitBootServices()
method, and attempt subsequent debug output only if the call fails.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r-- | src/interface/efi/efi_wrap.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/interface/efi/efi_wrap.c b/src/interface/efi/efi_wrap.c index 5c02a7ee1..65c70ea28 100644 --- a/src/interface/efi/efi_wrap.c +++ b/src/interface/efi/efi_wrap.c @@ -735,11 +735,14 @@ efi_exit_boot_services_wrapper ( EFI_HANDLE image_handle, UINTN map_key ) { void *retaddr = __builtin_return_address ( 0 ); EFI_STATUS efirc; - DBGC ( colour, "ExitBootServices ( %s, %#llx ) ", + DBGC ( colour, "ExitBootServices ( %s, %#llx ) -> %p\n", efi_handle_name ( image_handle ), - ( ( unsigned long long ) map_key ) ); + ( ( unsigned long long ) map_key ), retaddr ); efirc = bs->ExitBootServices ( image_handle, map_key ); - DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr ); + if ( efirc != 0 ) { + DBGC ( colour, "ExitBootServices ( ... ) = %s -> %p\n", + efi_status ( efirc ), retaddr ); + } return efirc; } |