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/highmem.h>
25 #include <linux/module.h>
26
27
28
29
30
31
32
33 void *kmap_atomic_prot(struct page *page, pgprot_t prot)
34 {
35 unsigned long vaddr;
36 int idx, type;
37
38 preempt_disable();
39 pagefault_disable();
40 if (!PageHighMem(page))
41 return page_address(page);
42
43 type = kmap_atomic_idx_push();
44 idx = type + KM_TYPE_NR*smp_processor_id();
45 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
46 WARN_ON(IS_ENABLED(CONFIG_DEBUG_HIGHMEM) && !pte_none(*(kmap_pte - idx)));
47 __set_pte_at(&init_mm, vaddr, kmap_pte-idx, mk_pte(page, prot), 1);
48 local_flush_tlb_page(NULL, vaddr);
49
50 return (void*) vaddr;
51 }
52 EXPORT_SYMBOL(kmap_atomic_prot);
53
54 void __kunmap_atomic(void *kvaddr)
55 {
56 unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK;
57
58 if (vaddr < __fix_to_virt(FIX_KMAP_END)) {
59 pagefault_enable();
60 preempt_enable();
61 return;
62 }
63
64 if (IS_ENABLED(CONFIG_DEBUG_HIGHMEM)) {
65 int type = kmap_atomic_idx();
66 unsigned int idx;
67
68 idx = type + KM_TYPE_NR * smp_processor_id();
69 WARN_ON(vaddr != __fix_to_virt(FIX_KMAP_BEGIN + idx));
70
71
72
73
74
75 pte_clear(&init_mm, vaddr, kmap_pte-idx);
76 local_flush_tlb_page(NULL, vaddr);
77 }
78
79 kmap_atomic_idx_pop();
80 pagefault_enable();
81 preempt_enable();
82 }
83 EXPORT_SYMBOL(__kunmap_atomic);