Messages in this thread Patch in this message | | | From | Andi Kleen <> | Subject | [PATCH CPA] [28/28] Make kernel_text test match boot mapping initialization | Date | Thu, 3 Jan 2008 16:24:43 +0100 (CET) |
| |
The boot direct mapping initialization used a different test to check if a page was part of the kernel mapping than c_p_a(). Fix that. Also round up to a large page size to be sure.
Signed-off-by: Andi Kleen <ak@suse.de>
--- arch/x86/mm/pageattr_32.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
Index: linux/arch/x86/mm/pageattr_32.c =================================================================== --- linux.orig/arch/x86/mm/pageattr_32.c +++ linux/arch/x86/mm/pageattr_32.c @@ -183,6 +183,12 @@ static int cache_attr_changed(pte_t pte, return a != (pgprot_val(prot) & _PAGE_CACHE); } +static int text_address(unsigned long addr) +{ + unsigned long end = ((unsigned long)__init_end & LARGE_PAGE_MASK); + return addr < end + LARGE_PAGE_SIZE; +} + /* * Mark the address for flushing later in global_tlb_flush(). * @@ -237,7 +243,7 @@ __change_page_attr(struct page *page, pg set_tlb_flush(address, cache_attr_changed(*kpte, prot, level), level < 3); - if ((address & LARGE_PAGE_MASK) < (unsigned long)&_etext) + if (text_address(address)) ref_prot = PAGE_KERNEL_EXEC; if (pgprot_val(prot) != pgprot_val(PAGE_KERNEL)) {
| |