提交 07240da2 编写于 作者: H Heinrich Schuchardt 提交者: Alexander Graf

efi_loader: relocate pointer to tables

When applying a virtual memory map we have to update the pointer to the
list of configuration tables.

Fixes: 4182a129 ("efi_loader: allocate configuration table array")
Reported-by: NMark Kettenis <mark.kettenis@xs4all.nl>
Signed-off-by: NHeinrich Schuchardt <xypron.glpk@gmx.de>
Tested-by: NMark Kettenis <kettenis@openbsd.org>
Signed-off-by: NAlexander Graf <agraf@suse.de>
上级 ccfc78b8
......@@ -360,6 +360,7 @@ static efi_status_t EFIAPI efi_set_virtual_address_map(
efi_physical_addr_t map_start = map->physical_start;
efi_physical_addr_t map_len = map->num_pages << EFI_PAGE_SHIFT;
efi_physical_addr_t map_end = map_start + map_len;
u64 off = map->virtual_start - map_start;
/* Adjust all mmio pointers in this region */
list_for_each(lhandle, &efi_runtime_mmio) {
......@@ -370,11 +371,17 @@ static efi_status_t EFIAPI efi_set_virtual_address_map(
link);
if ((map_start <= lmmio->paddr) &&
(map_end >= lmmio->paddr)) {
u64 off = map->virtual_start - map_start;
uintptr_t new_addr = lmmio->paddr + off;
*lmmio->ptr = (void *)new_addr;
}
}
if ((map_start <= (uintptr_t)systab.tables) &&
(map_end >= (uintptr_t)systab.tables)) {
char *ptr = (char *)systab.tables;
ptr += off;
systab.tables = (struct efi_configuration_table *)ptr;
}
}
/* Move the actual runtime code over */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册