:: commit 1c51ef85b0d191b5af6fbafc342692efd625a90b

mintsuki <mintsuki@protonmail.com> — 2023-12-06 23:37

parents: de646dfe2f

Revert "misc/efi: Call SetVirtualAddressMap when exiting boot services"

This reverts commit 0a27376a2b329438f6ed0c47de0fb81abe11eec0.
diff --git a/common/lib/misc.c b/common/lib/misc.c
index f015e639..18d1848c 100644
--- a/common/lib/misc.c
+++ b/common/lib/misc.c
@@ -151,7 +151,6 @@ error:
 #endif
 
 no_unwind bool efi_boot_services_exited = false;
-no_unwind bool efi_no_va_map = false;
 
 bool efi_exit_boot_services(void) {
     EFI_STATUS status;
@@ -200,21 +199,6 @@ retry:
         goto retry;
     }
 
-    for (size_t i = 0; i < efi_mmap_size / efi_desc_size; i++) {
-        EFI_MEMORY_DESCRIPTOR *md = (void *)efi_mmap + i * efi_desc_size;
-        if ((md->Attribute & EFI_MEMORY_RUNTIME) == 0) {
-            continue;
-        }
-
-        md->VirtualStart = md->PhysicalStart;
-    }
-
-    status = gRT->SetVirtualAddressMap(efi_mmap_size, efi_desc_size, efi_desc_ver, efi_mmap);
-    if (status != EFI_SUCCESS) {
-        print("efi: Failed to set virtual address map\n");
-        efi_no_va_map = true;
-    }
-
 #if defined(__x86_64__) || defined(__i386__)
     asm volatile ("cli" ::: "memory");
 #elif defined (__aarch64__)
diff --git a/common/lib/misc.h b/common/lib/misc.h
index a9fd5fe0..495c7984 100644
--- a/common/lib/misc.h
+++ b/common/lib/misc.h
@@ -25,8 +25,6 @@ extern UINTN efi_mmap_size, efi_desc_size;
 extern UINT32 efi_desc_ver;
 
 extern bool efi_boot_services_exited;
-extern bool efi_no_va_map;
-
 bool efi_exit_boot_services(void);
 #endif
 
tab: 248 wrap: offon