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)
Thu, Apr 25, 12:31 AM
Unknown Object (File)
Feb 12 2024, 12:08 AM
Unknown Object (File)
Dec 13 2023, 8:11 AM
Unknown Object (File)
Dec 11 2023, 10:04 PM
Unknown Object (File)
Dec 9 2023, 3:06 AM
Unknown Object (File)
Dec 5 2023, 11:16 AM
Unknown Object (File)
Nov 26 2023, 5:28 AM
Unknown Object (File)
Nov 24 2023, 9:59 PM
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 Not Applicable
Unit
Tests Not Applicable

Event Timeline

stand/efi/loader/arch/arm/exec.c
89 ↗(On Diff #54443)

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 ↗(On Diff #54443)

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)