mirror of
https://github.com/opnsense/src.git
synced 2026-06-11 09:41:03 -04:00
kboot: Use roundup2 instead of expanding the (old) definiution of it inline
The boot loader pads efi_map_header to start the array of efi_memory_descriptor entries on the 16-byte-aligned boundary after the header. Since the header isn't naturally 16-byte aligned, we need to do this. We should have used the actual UEFI EFI_MEMORY_ATTRIBUTES_TABLE which used uint32_t's to pass all this data to the kernel (they never needed to be 64-bit quantities or size_t's even) since these entries and the total size of the table is small. However, this ship long since sailed since we've used these structures for a decade and there's little to be gained by changing them. The table header we pass to the kernel from the loader has similar names, but the seamntics of the fields are different. Sponsored by: Netflix
This commit is contained in:
parent
085fc4555a
commit
849f8fea5c
1 changed files with 2 additions and 2 deletions
|
|
@ -36,7 +36,7 @@ foreach_efi_map_entry(struct efi_map_header *efihdr, efi_map_entry_cb cb, void *
|
|||
* Memory map data provided by UEFI via the GetMemoryMap
|
||||
* Boot Services API.
|
||||
*/
|
||||
efisz = (sizeof(struct efi_map_header) + 0xf) & ~0xf;
|
||||
efisz = roundup2(sizeof(struct efi_map_header), 16);
|
||||
map = (struct efi_md *)((uint8_t *)efihdr + efisz);
|
||||
|
||||
if (efihdr->descriptor_size == 0)
|
||||
|
|
@ -169,7 +169,7 @@ do_memory_from_fdt(int fd)
|
|||
* so early boot can copy the memory map into this space and have the
|
||||
* rest of the code cope.
|
||||
*/
|
||||
efisz = (sizeof(*efihdr) + 0xf) & ~0xf;
|
||||
efisz = roundup2(sizeof(*efihdr), 16);
|
||||
buf = malloc(sz + efisz);
|
||||
if (buf == NULL)
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Reference in a new issue