Commit 9488f6b2 authored by Anton Blanchard's avatar Anton Blanchard

ppc64: avoid bitops where possible in cacheflush avoidance code

parent 659c3522
...@@ -566,7 +566,8 @@ void __init mem_init(void) ...@@ -566,7 +566,8 @@ void __init mem_init(void)
*/ */
void flush_dcache_page(struct page *page) void flush_dcache_page(struct page *page)
{ {
clear_bit(PG_arch_1, &page->flags); if (test_bit(PG_arch_1, &page->flags))
clear_bit(PG_arch_1, &page->flags);
} }
void flush_icache_page(struct vm_area_struct *vma, struct page *page) void flush_icache_page(struct vm_area_struct *vma, struct page *page)
...@@ -589,10 +590,12 @@ void clear_user_page(void *page, unsigned long vaddr, struct page *pg) ...@@ -589,10 +590,12 @@ void clear_user_page(void *page, unsigned long vaddr, struct page *pg)
clear_page(page); clear_page(page);
/* XXX we shouldnt have to do this, but glibc requires it */ /* XXX we shouldnt have to do this, but glibc requires it */
if (cpu_has_noexecute()) if (cpu_has_noexecute()) {
clear_bit(PG_arch_1, &pg->flags); if (test_bit(PG_arch_1, &pg->flags))
else clear_bit(PG_arch_1, &pg->flags);
} else {
__flush_dcache_icache(page); __flush_dcache_icache(page);
}
} }
void copy_user_page(void *vto, void *vfrom, unsigned long vaddr, void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
...@@ -609,10 +612,12 @@ void copy_user_page(void *vto, void *vfrom, unsigned long vaddr, ...@@ -609,10 +612,12 @@ void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
return; return;
#endif #endif
if (cpu_has_noexecute()) if (cpu_has_noexecute()) {
clear_bit(PG_arch_1, &pg->flags); if (test_bit(PG_arch_1, &pg->flags))
else clear_bit(PG_arch_1, &pg->flags);
} else {
__flush_dcache_icache(vto); __flush_dcache_icache(vto);
}
} }
void flush_icache_user_range(struct vm_area_struct *vma, struct page *page, void flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment