Page MenuHomeFreeBSD

loader.efi: Defer efi_translate(e_entry) until after bi_load
ClosedPublic

Authored by jrtc27 on Thu, Apr 16, 7:19 PM.
Tags
None
Referenced Files
F153121806: D56431.diff
Sun, Apr 19, 7:44 AM
F153013580: D56431.diff
Sat, Apr 18, 3:22 PM
F153001976: D56431.diff
Sat, Apr 18, 1:57 PM
Unknown Object (File)
Sat, Apr 18, 5:25 AM
Unknown Object (File)
Sat, Apr 18, 5:25 AM
Unknown Object (File)
Sat, Apr 18, 5:25 AM
Unknown Object (File)
Sat, Apr 18, 4:40 AM
Subscribers

Details

Summary

bi_load itself loads various things into the staging area which can
cause it to grow, which may result in the staging area moving, including
the kernel. Therefore the address we get for the kernel entry point
prior to bi_load may not be correct afterwards when we actually call it,
and so we must defer the translation.

On arm and riscv (but not arm64, which predates both of them in
loader.efi and did not gain a copy of arm's added printf when arm
support was added) we also printf this entry point to the console, which
we can no longer do since bi_load calls ExitBootServices, so remove this
printf that, in practice, seems to not be so useful, given nobody ever
felt the need to add it to arm64. If anyone really feels this is an
important printf to have then bi_load will need to be split so we can
call printf after all the loading and potential reallocation of the
staging area, but before ExitBootServices is called.

We may also want to make this code more uniform and shared between the
three architectures here, since there isn't much architecture-specific
about this (and something like the RISC-V boot hart protocol could
easily be made an MD hook).

Fixes: 0cafabf97fae ("Add support for arm64 to loader.efi and boot1.efi")
Fixes: ea7796a9ae6b ("EFI: don't call printf after ExitBootServices, since it uses Boot Services")
Fixes: 2192efc03bc4 ("RISC-V boot1.efi and loader.efi support")
MFC after: 1 week

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Can't fault the logic. Wish we could print the address, but it's a lot less important in EFI than in other boot vectors.

This revision is now accepted and ready to land.Fri, Apr 17, 2:15 PM