This source file includes following definitions.
- kmap_atomic_prot
- __kunmap_atomic
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 #include <linux/export.h>
25 #include <linux/highmem.h>
26
27
28
29
30
31
32
33 #include <asm/tlbflush.h>
34
35 void *kmap_atomic_prot(struct page *page, pgprot_t prot)
36 {
37
38 unsigned long vaddr;
39 int idx, type;
40
41 preempt_disable();
42 pagefault_disable();
43 if (!PageHighMem(page))
44 return page_address(page);
45
46
47 type = kmap_atomic_idx_push();
48 idx = type + KM_TYPE_NR*smp_processor_id();
49 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
50 #ifdef CONFIG_DEBUG_HIGHMEM
51 BUG_ON(!pte_none(*(kmap_pte-idx)));
52 #endif
53 set_pte_at(&init_mm, vaddr, kmap_pte-idx, mk_pte(page, prot));
54 local_flush_tlb_page(NULL, vaddr);
55
56 return (void *) vaddr;
57 }
58 EXPORT_SYMBOL(kmap_atomic_prot);
59
60 void __kunmap_atomic(void *kvaddr)
61 {
62 unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK;
63 int type;
64 unsigned int idx;
65
66 if (vaddr < __fix_to_virt(FIX_KMAP_END)) {
67 pagefault_enable();
68 preempt_enable();
69 return;
70 }
71
72 type = kmap_atomic_idx();
73
74 idx = type + KM_TYPE_NR * smp_processor_id();
75 #ifdef CONFIG_DEBUG_HIGHMEM
76 BUG_ON(vaddr != __fix_to_virt(FIX_KMAP_BEGIN + idx));
77 #endif
78
79
80
81
82 pte_clear(&init_mm, vaddr, kmap_pte-idx);
83 local_flush_tlb_page(NULL, vaddr);
84
85 kmap_atomic_idx_pop();
86 pagefault_enable();
87 preempt_enable();
88 }
89 EXPORT_SYMBOL(__kunmap_atomic);