Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 356309
b: refs/heads/master
c: cca8e90
h: refs/heads/master
i:
  356307: bb67f64
v: v3
  • Loading branch information
John David Anglin authored and Helge Deller committed Feb 20, 2013
1 parent 273e7aa commit 9d3bac2
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6d2439d9558e259822fb487ec274cc9e362e6a81
refs/heads/master: cca8e9026041544c0103b3037d8f03c1d2f4ae02
64 changes: 64 additions & 0 deletions trunk/arch/parisc/kernel/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,3 +596,67 @@ flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, unsigned long
__flush_cache_page(vma, vmaddr, page_to_phys(pfn_to_page(pfn)));

}

#ifdef CONFIG_PARISC_TMPALIAS

void clear_user_highpage(struct page *page, unsigned long vaddr)
{
void *vto;
unsigned long flags;

/* Clear using TMPALIAS region. The page doesn't need to
be flushed but the kernel mapping needs to be purged. */

vto = kmap_atomic(page, KM_USER0);

/* The PA-RISC 2.0 Architecture book states on page F-6:
"Before a write-capable translation is enabled, *all*
non-equivalently-aliased translations must be removed
from the page table and purged from the TLB. (Note
that the caches are not required to be flushed at this
time.) Before any non-equivalent aliased translation
is re-enabled, the virtual address range for the writeable
page (the entire page) must be flushed from the cache,
and the write-capable translation removed from the page
table and purged from the TLB." */

purge_kernel_dcache_page_asm((unsigned long)vto);
purge_tlb_start(flags);
pdtlb_kernel(vto);
purge_tlb_end(flags);
preempt_disable();
clear_user_page_asm(vto, vaddr);
preempt_enable();

pagefault_enable(); /* kunmap_atomic(addr, KM_USER0); */
}

void copy_user_highpage(struct page *to, struct page *from,
unsigned long vaddr, struct vm_area_struct *vma)
{
void *vfrom, *vto;
unsigned long flags;

/* Copy using TMPALIAS region. This has the advantage
that the `from' page doesn't need to be flushed. However,
the `to' page must be flushed in copy_user_page_asm since
it can be used to bring in executable code. */

vfrom = kmap_atomic(from, KM_USER0);
vto = kmap_atomic(to, KM_USER1);

purge_kernel_dcache_page_asm((unsigned long)vto);
purge_tlb_start(flags);
pdtlb_kernel(vto);
pdtlb_kernel(vfrom);
purge_tlb_end(flags);
preempt_disable();
copy_user_page_asm(vto, vfrom, vaddr);
flush_dcache_page_asm(__pa(vto), vaddr);
preempt_enable();

pagefault_enable(); /* kunmap_atomic(addr, KM_USER1); */
pagefault_enable(); /* kunmap_atomic(addr, KM_USER0); */
}

#endif /* CONFIG_PARISC_TMPALIAS */

0 comments on commit 9d3bac2

Please sign in to comment.