diff options
Diffstat (limited to 'lib/efi_loader/efi_runtime.c')
-rw-r--r-- | lib/efi_loader/efi_runtime.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c index fb241314620..ced00516f73 100644 --- a/lib/efi_loader/efi_runtime.c +++ b/lib/efi_loader/efi_runtime.c @@ -565,7 +565,10 @@ void efi_runtime_relocate(ulong offset, struct efi_mem_desc *map) p = (void*)((ulong)rel->offset - base) + gd->relocaddr; - /* The runtime services are updated in efi_runtime_detach() */ + /* + * The runtime services table is updated in + * efi_relocate_runtime_table() + */ if (map && efi_is_runtime_service_pointer(p)) continue; @@ -641,12 +644,17 @@ static efi_status_t EFIAPI efi_set_virtual_address_map( { efi_uintn_t n = memory_map_size / descriptor_size; efi_uintn_t i; + efi_status_t ret = EFI_INVALID_PARAMETER; int rt_code_sections = 0; struct efi_event *event; EFI_ENTRY("%zx %zx %x %p", memory_map_size, descriptor_size, descriptor_version, virtmap); + if (descriptor_version != EFI_MEMORY_DESCRIPTOR_VERSION || + descriptor_size < sizeof(struct efi_mem_desc)) + goto out; + efi_virtmap = virtmap; efi_descriptor_size = descriptor_size; efi_descriptor_count = n; @@ -677,7 +685,7 @@ static efi_status_t EFIAPI efi_set_virtual_address_map( * We expose exactly one single runtime code section, so * something is definitely going wrong. */ - return EFI_EXIT(EFI_INVALID_PARAMETER); + goto out; } /* Notify EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE */ @@ -719,14 +727,6 @@ static efi_status_t EFIAPI efi_set_virtual_address_map( } } - /* - * Some runtime services are implemented in a way that we can only offer - * them at boottime. Replace those function pointers. - * - * TODO: move this call to ExitBootServices(). - */ - efi_runtime_detach(); - /* Relocate the runtime. See TODO above */ for (i = 0; i < n; i++) { struct efi_mem_desc *map; @@ -738,11 +738,13 @@ static efi_status_t EFIAPI efi_set_virtual_address_map( efi_relocate_runtime_table(new_offset); efi_runtime_relocate(new_offset, map); - return EFI_EXIT(EFI_SUCCESS); + ret = EFI_SUCCESS; + goto out; } } - return EFI_EXIT(EFI_INVALID_PARAMETER); +out: + return EFI_EXIT(ret); } /** |