X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=arch%2Fx86%2Fmm%2Finit_32.c;h=4d115654519442babfa3e0d2a3f4d4fc3749a9b6;hb=3c1df68b848b39270752ff8d4b956cc4a4dce0f6;hp=7c9bb3076b8a13c8c52f96e1329f4e977db6dfb0;hpb=6d238cc4dc8a36a3915c26202fe49f58a0683fb9;p=linux-2.6 diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index 7c9bb3076b..4d11565451 100644 --- a/arch/x86/mm/init_32.c +++ b/arch/x86/mm/init_32.c @@ -211,28 +211,6 @@ static inline int page_kills_ppro(unsigned long pagenr) return 0; } -int page_is_ram(unsigned long pagenr) -{ - int i; - unsigned long addr, end; - - for (i = 0; i < e820.nr_map; i++) { - - if (e820.map[i].type != E820_RAM) /* not usable memory */ - continue; - /* - * !!!FIXME!!! Some BIOSen report areas as RAM that - * are not. Notably the 640->1Mb area. We need a sanity - * check here. - */ - addr = (e820.map[i].addr+PAGE_SIZE-1) >> PAGE_SHIFT; - end = (e820.map[i].addr+e820.map[i].size) >> PAGE_SHIFT; - if ((pagenr >= addr) && (pagenr < end)) - return 1; - } - return 0; -} - #ifdef CONFIG_HIGHMEM pte_t *kmap_pte; pgprot_t kmap_prot; @@ -774,15 +752,11 @@ void mark_rodata_ro(void) printk("Write protecting the kernel text: %luk\n", size >> 10); #ifdef CONFIG_CPA_DEBUG - global_flush_tlb(); - printk("Testing CPA: Reverting %lx-%lx\n", start, start+size); set_pages_rw(virt_to_page(start), size>>PAGE_SHIFT); - global_flush_tlb(); printk("Testing CPA: write protecting again\n"); set_pages_ro(virt_to_page(start), size>>PAGE_SHIFT); - global_flush_tlb(); #endif } #endif @@ -792,22 +766,12 @@ void mark_rodata_ro(void) printk("Write protecting the kernel read-only data: %luk\n", size >> 10); - /* - * set_pages_*() requires a global_flush_tlb() call after it. - * We do this after the printk so that if something went wrong in the - * change, the printk gets out at least to give a better debug hint - * of who is the culprit. - */ - global_flush_tlb(); - #ifdef CONFIG_CPA_DEBUG printk("Testing CPA: undo %lx-%lx\n", start, start + size); set_pages_rw(virt_to_page(start), size >> PAGE_SHIFT); - global_flush_tlb(); printk("Testing CPA: write protecting again\n"); set_pages_ro(virt_to_page(start), size >> PAGE_SHIFT); - global_flush_tlb(); #endif } #endif @@ -816,6 +780,13 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end) { unsigned long addr; + /* + * We just marked the kernel text read only above, now that + * we are going to free part of that, we need to make that + * writeable first. + */ + set_memory_rw(begin, (end - begin) >> PAGE_SHIFT); + for (addr = begin; addr < end; addr += PAGE_SIZE) { ClearPageReserved(virt_to_page(addr)); init_page_count(virt_to_page(addr));