summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2018-08-04 23:16:06 +0200
committerAlexander Graf <agraf@suse.de>2018-08-20 11:39:19 +0200
commit07240da293379cc3e50fef1615b14225d7d583af (patch)
tree3673c73545cbdf2418c060706a367bc0342ccd00 /lib
parentccfc78b820e5e431c5bd73b072e7536a972e1710 (diff)
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: 4182a129ef73 ("efi_loader: allocate configuration table array") Reported-by: Mark Kettenis <mark.kettenis@xs4all.nl> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Tested-by: Mark Kettenis <kettenis@openbsd.org> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_loader/efi_runtime.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c
index 06958f23fa..45b7809dec 100644
--- a/lib/efi_loader/efi_runtime.c
+++ b/lib/efi_loader/efi_runtime.c
@@ -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 */