aboutsummaryrefslogtreecommitdiff
path: root/arch/x86/kernel/efi_64.c
diff options
context:
space:
mode:
authorHuang, Ying <ying.huang@intel.com>2008-01-30 13:33:55 +0100
committerIngo Molnar <mingo@elte.hu>2008-01-30 13:33:55 +0100
commita2172e2586f6662af996e47f417bb718c37cf8d2 (patch)
treef2430abad9fd9417653a3a2faa472d9df0c308bd /arch/x86/kernel/efi_64.c
parentcd58289667293593b04fd315ec7f2f37589134cb (diff)
x86: fix some bugs about EFI runtime code mapping
This patch fixes some bugs of making EFI runtime code executable. - Use change_page_attr in i386 too. Because the runtime code may be mapped not through ioremap. - If there is no _PAGE_NX in __supported_pte_mask, the change_page_attr is not called. - Make efi_ioremap map pages as PAGE_KERNEL_EXEC_NOCACHE, because EFI runtime code may be mapped through efi_ioremap. Signed-off-by: Huang Ying <ying.huang@intel.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/efi_64.c')
-rw-r--r--arch/x86/kernel/efi_64.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/arch/x86/kernel/efi_64.c b/arch/x86/kernel/efi_64.c
index 1f8bbd9644d..9f8a7559439 100644
--- a/arch/x86/kernel/efi_64.c
+++ b/arch/x86/kernel/efi_64.c
@@ -33,7 +33,6 @@
#include <asm/e820.h>
#include <asm/pgtable.h>
#include <asm/tlbflush.h>
-#include <asm/cacheflush.h>
#include <asm/proto.h>
#include <asm/efi.h>
@@ -55,7 +54,7 @@ static void __init early_mapping_set_exec(unsigned long start,
else
set_pte(kpte, __pte((pte_val(*kpte) | _PAGE_NX) & \
__supported_pte_mask));
- if (pte_huge(*kpte))
+ if (level == 4)
start = (start + PMD_SIZE) & PMD_MASK;
else
start = (start + PAGE_SIZE) & PAGE_MASK;
@@ -67,6 +66,9 @@ static void __init early_runtime_code_mapping_set_exec(int executable)
efi_memory_desc_t *md;
void *p;
+ if (!(__supported_pte_mask & _PAGE_NX))
+ return;
+
/* Make EFI runtime service code area executable */
for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
md = p;
@@ -116,22 +118,6 @@ void __init efi_reserve_bootmem(void)
memmap.nr_map * memmap.desc_size);
}
-void __init runtime_code_page_mkexec(void)
-{
- efi_memory_desc_t *md;
- void *p;
-
- /* Make EFI runtime service code area executable */
- for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
- md = p;
- if (md->type == EFI_RUNTIME_SERVICES_CODE)
- change_page_attr_addr(md->virt_addr,
- md->num_pages,
- PAGE_KERNEL_EXEC);
- }
- __flush_tlb_all();
-}
-
void __iomem * __init efi_ioremap(unsigned long offset,
unsigned long size)
{
@@ -146,8 +132,8 @@ void __iomem * __init efi_ioremap(unsigned long offset,
return NULL;
for (i = 0; i < pages; i++) {
- set_fixmap_nocache(FIX_EFI_IO_MAP_FIRST_PAGE - pages_mapped,
- offset);
+ __set_fixmap(FIX_EFI_IO_MAP_FIRST_PAGE - pages_mapped,
+ offset, PAGE_KERNEL_EXEC_NOCACHE);
offset += PAGE_SIZE;
pages_mapped++;
}