shithub: riscv

Download patch

ref: d67e83ed27fbb11ad21880352e706e095ecc0dfb
parent: 12ccc63ec3d72d1ef5b591c7f50534ac3b1e890b
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Fri Dec 2 15:08:36 EST 2022

9boot: delay GetMemoryMap until right before ExitBootServices (thanks michael forney!)

Michael Forney reported the following:

The UEFI specification suggests calling GetMemoryMap immediately
before ExitBootServices to ensure that the loader has the current
memory map. The firmware is able to enforce this since we have to
pass a "MapKey" from the last GetMemoryMap to ExitBootServices.

The T14 AMD gen 1 firmware is quite strict about this, and even a call
to OutputString will invalidate the MapKey. This causes
ExitBootServices to fail, and we enter 9front with boot services still
running. This causes all sorts of problems including leaving the
IOMMU enabled, breaking 9front's PCI drivers.

---

Michael sent a patch that moves memconf() to unload(), but i prefer
to make this explicit by calling memconf() before and keep unload() as
just that, not touching the configuration.