Page MenuHomeFreeBSD

EFI: don't call printf after ExitBootServices, since it uses Boot Services
ClosedPublic

Authored by bcran on Feb 27 2019, 12:59 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 6, 6:25 AM
Unknown Object (File)
Oct 3 2024, 2:15 PM
Unknown Object (File)
Sep 20 2024, 5:38 PM
Unknown Object (File)
Sep 9 2024, 2:13 AM
Unknown Object (File)
Sep 8 2024, 7:38 AM
Unknown Object (File)
Sep 8 2024, 2:11 AM
Unknown Object (File)
Sep 7 2024, 2:33 PM
Unknown Object (File)
Sep 6 2024, 12:30 AM
Subscribers

Details

Summary

ExitBootServices terminates all boot services including console access. Attempting
to call printf afterwards can result in a crash, depending on the implementation.

So, we need to move any printf statements to before we call bi_load, and remove any that
depend on calling bi_load first.

Test Plan

Tested on i386 (MinnowBoard Turbot): loader now proceeds to the point where it starts executing the kernel
I'm running a "make tinderbox" to verify that arm still builds.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 22764
Build 21856: arc lint + arc unit

Event Timeline

stand/efi/loader/arch/arm/exec.c
89

It is not really about allocations - loader does still use the pre-allocated heap, but it is about the need to avoid calling Boot Services (note, Runtime Services are ok). And printf() is directly related to BS because we do use SimpleTextOutputProtocol.

stand/efi/loader/arch/arm/exec.c
89

Ah, of course! Thanks, I'll update the comment.

This revision is now accepted and ready to land.Feb 27 2019, 2:26 PM
This revision was automatically updated to reflect the committed changes.
bcran retitled this revision from EFI: don't call printf after ExitBootServices, since it allocates memory to EFI: don't call printf after ExitBootServices, since it uses Boot Services.Mar 2 2019, 4:03 AM
bcran edited the summary of this revision. (Show Details)