1
2
3
4
5
6
7
8
9
10
11
12#include <linux/module.h>
13#include <linux/mm.h>
14#include <linux/pagemap.h>
15
16#include <asm/cacheflush.h>
17#include <asm/tlbflush.h>
18
19void flush_cache_mm(struct mm_struct *mm)
20{
21}
22
23void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
24 unsigned long end)
25{
26 if (vma->vm_flags & VM_EXEC)
27 __flush_icache_all();
28}
29
30void flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr,
31 unsigned long pfn)
32{
33}
34
35static void flush_ptrace_access(struct vm_area_struct *vma, struct page *page,
36 unsigned long uaddr, void *kaddr, unsigned long len)
37{
38
39 if (vma->vm_flags & VM_EXEC) {
40 unsigned long addr = (unsigned long)kaddr;
41
42 __cpuc_coherent_kern_range(addr, addr + len);
43 }
44}
45
46
47
48
49
50
51
52
53void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
54 unsigned long uaddr, void *dst, const void *src,
55 unsigned long len)
56{
57 memcpy(dst, src, len);
58 flush_ptrace_access(vma, page, uaddr, dst, len);
59}
60
61void __flush_dcache_page(struct address_space *mapping, struct page *page)
62{
63
64
65
66
67
68 __cpuc_flush_kern_dcache_area(page_address(page), PAGE_SIZE);
69}
70
71
72
73
74
75void flush_dcache_page(struct page *page)
76{
77 struct address_space *mapping;
78
79
80
81
82
83 if (page == ZERO_PAGE(0))
84 return;
85
86 mapping = page_mapping_file(page);
87
88 if (mapping && !mapping_mapped(mapping))
89 clear_bit(PG_dcache_clean, &page->flags);
90 else {
91 __flush_dcache_page(mapping, page);
92 if (mapping)
93 __flush_icache_all();
94 set_bit(PG_dcache_clean, &page->flags);
95 }
96}
97EXPORT_SYMBOL(flush_dcache_page);
98