aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/platform/efi/efi.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/platform/efi/efi.c')
-rw-r--r--arch/x86/platform/efi/efi.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index f2e4fe9e92a1..7daae27e975e 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -457,11 +457,25 @@ void __init efi_init(void)
457#endif 457#endif
458} 458}
459 459
460void __init efi_set_executable(efi_memory_desc_t *md, bool executable)
461{
462 u64 addr, npages;
463
464 addr = md->virt_addr;
465 npages = md->num_pages;
466
467 memrange_efi_to_native(&addr, &npages);
468
469 if (executable)
470 set_memory_x(addr, npages);
471 else
472 set_memory_nx(addr, npages);
473}
474
460static void __init runtime_code_page_mkexec(void) 475static void __init runtime_code_page_mkexec(void)
461{ 476{
462 efi_memory_desc_t *md; 477 efi_memory_desc_t *md;
463 void *p; 478 void *p;
464 u64 addr, npages;
465 479
466 /* Make EFI runtime service code area executable */ 480 /* Make EFI runtime service code area executable */
467 for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) { 481 for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
@@ -470,10 +484,7 @@ static void __init runtime_code_page_mkexec(void)
470 if (md->type != EFI_RUNTIME_SERVICES_CODE) 484 if (md->type != EFI_RUNTIME_SERVICES_CODE)
471 continue; 485 continue;
472 486
473 addr = md->virt_addr; 487 efi_set_executable(md, true);
474 npages = md->num_pages;
475 memrange_efi_to_native(&addr, &npages);
476 set_memory_x(addr, npages);
477 } 488 }
478} 489}
479 490