x86: convert CPA users to the new set_page_ API

This patch converts various users of change_page_attr() to the new,
more intent driven set_page_*/set_memory_* API set.

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Arjan van de Ven
2008-01-30 13:34:06 +01:00
committed by Ingo Molnar
父節點 75cbade8ea
當前提交 6d238cc4dc
共有 8 個文件被更改,包括 29 次插入38 次删除

查看文件

@@ -770,34 +770,30 @@ void mark_rodata_ro(void)
if (num_possible_cpus() <= 1)
#endif
{
change_page_attr(virt_to_page(start),
size >> PAGE_SHIFT, PAGE_KERNEL_RX);
set_pages_ro(virt_to_page(start), size >> PAGE_SHIFT);
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);
change_page_attr(virt_to_page(start), size>>PAGE_SHIFT,
PAGE_KERNEL_EXEC);
set_pages_rw(virt_to_page(start), size>>PAGE_SHIFT);
global_flush_tlb();
printk("Testing CPA: write protecting again\n");
change_page_attr(virt_to_page(start), size>>PAGE_SHIFT,
PAGE_KERNEL_RX);
set_pages_ro(virt_to_page(start), size>>PAGE_SHIFT);
global_flush_tlb();
#endif
}
#endif
start += size;
size = (unsigned long)__end_rodata - start;
change_page_attr(virt_to_page(start),
size >> PAGE_SHIFT, PAGE_KERNEL_RO);
set_pages_ro(virt_to_page(start), size >> PAGE_SHIFT);
printk("Write protecting the kernel read-only data: %luk\n",
size >> 10);
/*
* change_page_attr() requires a global_flush_tlb() call after it.
* 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.
@@ -806,13 +802,11 @@ void mark_rodata_ro(void)
#ifdef CONFIG_CPA_DEBUG
printk("Testing CPA: undo %lx-%lx\n", start, start + size);
change_page_attr(virt_to_page(start), size >> PAGE_SHIFT,
PAGE_KERNEL);
set_pages_rw(virt_to_page(start), size >> PAGE_SHIFT);
global_flush_tlb();
printk("Testing CPA: write protecting again\n");
change_page_attr(virt_to_page(start), size >> PAGE_SHIFT,
PAGE_KERNEL_RO);
set_pages_ro(virt_to_page(start), size >> PAGE_SHIFT);
global_flush_tlb();
#endif
}

查看文件

@@ -556,8 +556,6 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
init_page_count(virt_to_page(addr));
memset((void *)(addr & ~(PAGE_SIZE-1)),
POISON_FREE_INITMEM, PAGE_SIZE);
if (addr >= __START_KERNEL_map)
change_page_attr_addr(addr, 1, __pgprot(0));
free_page(addr);
totalram_pages++;
}
@@ -594,13 +592,13 @@ void mark_rodata_ro(void)
if (end <= start)
return;
change_page_attr_addr(start, (end - start) >> PAGE_SHIFT, PAGE_KERNEL_RO);
set_memory_ro(start, (end - start) >> PAGE_SHIFT);
printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n",
(end - start) >> 10);
/*
* change_page_attr_addr() requires a global_flush_tlb() call after it.
* set_memory_*() 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.
@@ -609,11 +607,11 @@ void mark_rodata_ro(void)
#ifdef CONFIG_CPA_DEBUG
printk("Testing CPA: undo %lx-%lx\n", start, end);
change_page_attr_addr(start, (end - start) >> PAGE_SHIFT, PAGE_KERNEL);
set_memory_rw(start, (end-start) >> PAGE_SHIFT);
global_flush_tlb();
printk("Testing CPA: again\n");
change_page_attr_addr(start, (end - start) >> PAGE_SHIFT, PAGE_KERNEL_RO);
set_memory_ro(start, (end-start) >> PAGE_SHIFT);
global_flush_tlb();
#endif
}