This fixes a problem encountered on the Thinkpad X220/Yoga 11e where runtime services would try to inexplicably jump to other parts of memory where it shouldn't be when attempting to enumerate EFI vars, causing a panic.
Details
Details
Diff Detail
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
stand/efi/loader/bootinfo.c | ||
---|---|---|
249 ↗ | (On Diff #40242) | We already have NextMemoryDescriptor() macro. |
259 ↗ | (On Diff #40242) | Copy the whole structure, it is simpler IMO. Also you may assign to desc->VirtualStart before, then you only need to do it once. |
360 ↗ | (On Diff #40242) | A variable to request not calling SetVirtualAddressMap() might be useful. |
Comment Actions
Address feedback by @kib:
- Use already defined NextMemoryDescriptor
- Set VA = PA then memcpy whole descriptor
- Allow efi_disable_vmap to be set in loader.conf(5) to disable virtual mapping
stand/efi/loader/bootinfo.c | ||
---|---|---|
249 ↗ | (On Diff #40242) | I swear that wasn't there when I was throwing this together last night. |
stand/efi/loader/bootinfo.c | ||
---|---|---|
259 ↗ | (On Diff #40244) | I wasn't sure if this was OK or not- mmsz seems to be larger than sizeof(*desc), and I wasn't sure if the excess was just padding or firmware-specific bits that should be preserved. |
stand/efi/loader/bootinfo.c | ||
---|---|---|
259 ↗ | (On Diff #40244) | Ok. |
Comment Actions
Address a couple more concerns:
- Consolidate desc, viter, vmap declarations
- Just set *viter = *desc; I thought I had observed that mmsz > sizeof(*desc) in early testing yesterday, but mmsz is explicitly set to sizeof(EFI_MEMORY_DESCRIPTOR)...
- Don't use implicit boolean tresting for (attribute & EFI_MEMORY_RUNTIME)