]>
Commit | Line | Data |
---|---|---|
5e1f65a6 | 1 | /* |
ba180fd4 | 2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
1da177e4 LT |
3 | * Licensed under the GPL |
4 | */ | |
5 | ||
8192ab42 | 6 | #include <linux/mm.h> |
73395a00 | 7 | #include <linux/module.h> |
8192ab42 JD |
8 | #include <linux/sched.h> |
9 | #include <asm/pgtable.h> | |
10 | #include <asm/tlbflush.h> | |
37185b33 AV |
11 | #include <as-layout.h> |
12 | #include <mem_user.h> | |
13 | #include <os.h> | |
14 | #include <skas.h> | |
1da177e4 | 15 | |
1466abf2 JD |
16 | struct host_vm_change { |
17 | struct host_vm_op { | |
18 | enum { NONE, MMAP, MUNMAP, MPROTECT } type; | |
19 | union { | |
20 | struct { | |
21 | unsigned long addr; | |
22 | unsigned long len; | |
23 | unsigned int prot; | |
24 | int fd; | |
25 | __u64 offset; | |
26 | } mmap; | |
27 | struct { | |
28 | unsigned long addr; | |
29 | unsigned long len; | |
30 | } munmap; | |
31 | struct { | |
32 | unsigned long addr; | |
33 | unsigned long len; | |
34 | unsigned int prot; | |
35 | } mprotect; | |
36 | } u; | |
37 | } ops[1]; | |
38 | int index; | |
39 | struct mm_id *id; | |
40 | void *data; | |
41 | int force; | |
42 | }; | |
43 | ||
44 | #define INIT_HVC(mm, force) \ | |
45 | ((struct host_vm_change) \ | |
46 | { .ops = { { .type = NONE } }, \ | |
47 | .id = &mm->context.id, \ | |
48 | .data = NULL, \ | |
49 | .index = 0, \ | |
50 | .force = force }) | |
51 | ||
52 | static int do_ops(struct host_vm_change *hvc, int end, | |
53 | int finished) | |
54 | { | |
55 | struct host_vm_op *op; | |
56 | int i, ret = 0; | |
57 | ||
58 | for (i = 0; i < end && !ret; i++) { | |
59 | op = &hvc->ops[i]; | |
c5d4bb17 | 60 | switch (op->type) { |
1466abf2 JD |
61 | case MMAP: |
62 | ret = map(hvc->id, op->u.mmap.addr, op->u.mmap.len, | |
63 | op->u.mmap.prot, op->u.mmap.fd, | |
64 | op->u.mmap.offset, finished, &hvc->data); | |
65 | break; | |
66 | case MUNMAP: | |
67 | ret = unmap(hvc->id, op->u.munmap.addr, | |
68 | op->u.munmap.len, finished, &hvc->data); | |
69 | break; | |
70 | case MPROTECT: | |
71 | ret = protect(hvc->id, op->u.mprotect.addr, | |
72 | op->u.mprotect.len, op->u.mprotect.prot, | |
73 | finished, &hvc->data); | |
74 | break; | |
75 | default: | |
76 | printk(KERN_ERR "Unknown op type %d in do_ops\n", | |
77 | op->type); | |
62179d47 | 78 | BUG(); |
1466abf2 JD |
79 | break; |
80 | } | |
81 | } | |
82 | ||
83 | return ret; | |
84 | } | |
85 | ||
c5600490 | 86 | static int add_mmap(unsigned long virt, unsigned long phys, unsigned long len, |
1466abf2 | 87 | unsigned int prot, struct host_vm_change *hvc) |
c5600490 | 88 | { |
5e1f65a6 | 89 | __u64 offset; |
c5600490 | 90 | struct host_vm_op *last; |
07bf731e | 91 | int fd, ret = 0; |
c5600490 JD |
92 | |
93 | fd = phys_mapping(phys, &offset); | |
1466abf2 JD |
94 | if (hvc->index != 0) { |
95 | last = &hvc->ops[hvc->index - 1]; | |
ba180fd4 | 96 | if ((last->type == MMAP) && |
c5600490 | 97 | (last->u.mmap.addr + last->u.mmap.len == virt) && |
16dd07bc | 98 | (last->u.mmap.prot == prot) && (last->u.mmap.fd == fd) && |
ba180fd4 | 99 | (last->u.mmap.offset + last->u.mmap.len == offset)) { |
c5600490 | 100 | last->u.mmap.len += len; |
07bf731e | 101 | return 0; |
c5600490 JD |
102 | } |
103 | } | |
104 | ||
1466abf2 JD |
105 | if (hvc->index == ARRAY_SIZE(hvc->ops)) { |
106 | ret = do_ops(hvc, ARRAY_SIZE(hvc->ops), 0); | |
107 | hvc->index = 0; | |
c5600490 JD |
108 | } |
109 | ||
1466abf2 JD |
110 | hvc->ops[hvc->index++] = ((struct host_vm_op) |
111 | { .type = MMAP, | |
112 | .u = { .mmap = { .addr = virt, | |
113 | .len = len, | |
114 | .prot = prot, | |
115 | .fd = fd, | |
116 | .offset = offset } | |
07bf731e BS |
117 | } }); |
118 | return ret; | |
c5600490 JD |
119 | } |
120 | ||
121 | static int add_munmap(unsigned long addr, unsigned long len, | |
1466abf2 | 122 | struct host_vm_change *hvc) |
c5600490 JD |
123 | { |
124 | struct host_vm_op *last; | |
07bf731e | 125 | int ret = 0; |
c5600490 | 126 | |
1466abf2 JD |
127 | if (hvc->index != 0) { |
128 | last = &hvc->ops[hvc->index - 1]; | |
ba180fd4 JD |
129 | if ((last->type == MUNMAP) && |
130 | (last->u.munmap.addr + last->u.mmap.len == addr)) { | |
c5600490 | 131 | last->u.munmap.len += len; |
07bf731e | 132 | return 0; |
c5600490 JD |
133 | } |
134 | } | |
135 | ||
1466abf2 JD |
136 | if (hvc->index == ARRAY_SIZE(hvc->ops)) { |
137 | ret = do_ops(hvc, ARRAY_SIZE(hvc->ops), 0); | |
138 | hvc->index = 0; | |
c5600490 JD |
139 | } |
140 | ||
1466abf2 JD |
141 | hvc->ops[hvc->index++] = ((struct host_vm_op) |
142 | { .type = MUNMAP, | |
143 | .u = { .munmap = { .addr = addr, | |
144 | .len = len } } }); | |
07bf731e | 145 | return ret; |
c5600490 JD |
146 | } |
147 | ||
16dd07bc | 148 | static int add_mprotect(unsigned long addr, unsigned long len, |
1466abf2 | 149 | unsigned int prot, struct host_vm_change *hvc) |
c5600490 JD |
150 | { |
151 | struct host_vm_op *last; | |
07bf731e | 152 | int ret = 0; |
c5600490 | 153 | |
1466abf2 JD |
154 | if (hvc->index != 0) { |
155 | last = &hvc->ops[hvc->index - 1]; | |
ba180fd4 | 156 | if ((last->type == MPROTECT) && |
c5600490 | 157 | (last->u.mprotect.addr + last->u.mprotect.len == addr) && |
ba180fd4 | 158 | (last->u.mprotect.prot == prot)) { |
c5600490 | 159 | last->u.mprotect.len += len; |
07bf731e | 160 | return 0; |
c5600490 JD |
161 | } |
162 | } | |
163 | ||
1466abf2 JD |
164 | if (hvc->index == ARRAY_SIZE(hvc->ops)) { |
165 | ret = do_ops(hvc, ARRAY_SIZE(hvc->ops), 0); | |
166 | hvc->index = 0; | |
c5600490 JD |
167 | } |
168 | ||
1466abf2 JD |
169 | hvc->ops[hvc->index++] = ((struct host_vm_op) |
170 | { .type = MPROTECT, | |
171 | .u = { .mprotect = { .addr = addr, | |
172 | .len = len, | |
173 | .prot = prot } } }); | |
07bf731e | 174 | return ret; |
c5600490 JD |
175 | } |
176 | ||
1da177e4 LT |
177 | #define ADD_ROUND(n, inc) (((n) + (inc)) & ~((inc) - 1)) |
178 | ||
7f0536f8 | 179 | static inline int update_pte_range(pmd_t *pmd, unsigned long addr, |
1466abf2 JD |
180 | unsigned long end, |
181 | struct host_vm_change *hvc) | |
7f0536f8 JD |
182 | { |
183 | pte_t *pte; | |
16dd07bc | 184 | int r, w, x, prot, ret = 0; |
7f0536f8 JD |
185 | |
186 | pte = pte_offset_kernel(pmd, addr); | |
187 | do { | |
3963333f JD |
188 | if ((addr >= STUB_START) && (addr < STUB_END)) |
189 | continue; | |
190 | ||
7f0536f8 JD |
191 | r = pte_read(*pte); |
192 | w = pte_write(*pte); | |
193 | x = pte_exec(*pte); | |
194 | if (!pte_young(*pte)) { | |
195 | r = 0; | |
196 | w = 0; | |
0b4e273f | 197 | } else if (!pte_dirty(*pte)) |
7f0536f8 | 198 | w = 0; |
0b4e273f | 199 | |
16dd07bc JD |
200 | prot = ((r ? UM_PROT_READ : 0) | (w ? UM_PROT_WRITE : 0) | |
201 | (x ? UM_PROT_EXEC : 0)); | |
1466abf2 | 202 | if (hvc->force || pte_newpage(*pte)) { |
ba180fd4 | 203 | if (pte_present(*pte)) |
7f0536f8 | 204 | ret = add_mmap(addr, pte_val(*pte) & PAGE_MASK, |
1466abf2 | 205 | PAGE_SIZE, prot, hvc); |
0b4e273f JD |
206 | else |
207 | ret = add_munmap(addr, PAGE_SIZE, hvc); | |
208 | } else if (pte_newprot(*pte)) | |
1466abf2 | 209 | ret = add_mprotect(addr, PAGE_SIZE, prot, hvc); |
7f0536f8 | 210 | *pte = pte_mkuptodate(*pte); |
909e90d3 | 211 | } while (pte++, addr += PAGE_SIZE, ((addr < end) && !ret)); |
7f0536f8 JD |
212 | return ret; |
213 | } | |
214 | ||
215 | static inline int update_pmd_range(pud_t *pud, unsigned long addr, | |
1466abf2 JD |
216 | unsigned long end, |
217 | struct host_vm_change *hvc) | |
7f0536f8 JD |
218 | { |
219 | pmd_t *pmd; | |
220 | unsigned long next; | |
221 | int ret = 0; | |
222 | ||
223 | pmd = pmd_offset(pud, addr); | |
224 | do { | |
225 | next = pmd_addr_end(addr, end); | |
ba180fd4 | 226 | if (!pmd_present(*pmd)) { |
1466abf2 JD |
227 | if (hvc->force || pmd_newpage(*pmd)) { |
228 | ret = add_munmap(addr, next - addr, hvc); | |
7f0536f8 JD |
229 | pmd_mkuptodate(*pmd); |
230 | } | |
231 | } | |
1466abf2 | 232 | else ret = update_pte_range(pmd, addr, next, hvc); |
909e90d3 | 233 | } while (pmd++, addr = next, ((addr < end) && !ret)); |
7f0536f8 JD |
234 | return ret; |
235 | } | |
236 | ||
237 | static inline int update_pud_range(pgd_t *pgd, unsigned long addr, | |
1466abf2 JD |
238 | unsigned long end, |
239 | struct host_vm_change *hvc) | |
7f0536f8 JD |
240 | { |
241 | pud_t *pud; | |
242 | unsigned long next; | |
243 | int ret = 0; | |
244 | ||
245 | pud = pud_offset(pgd, addr); | |
246 | do { | |
247 | next = pud_addr_end(addr, end); | |
ba180fd4 | 248 | if (!pud_present(*pud)) { |
1466abf2 JD |
249 | if (hvc->force || pud_newpage(*pud)) { |
250 | ret = add_munmap(addr, next - addr, hvc); | |
7f0536f8 JD |
251 | pud_mkuptodate(*pud); |
252 | } | |
253 | } | |
1466abf2 | 254 | else ret = update_pmd_range(pud, addr, next, hvc); |
909e90d3 | 255 | } while (pud++, addr = next, ((addr < end) && !ret)); |
7f0536f8 JD |
256 | return ret; |
257 | } | |
258 | ||
1da177e4 | 259 | void fix_range_common(struct mm_struct *mm, unsigned long start_addr, |
1466abf2 | 260 | unsigned long end_addr, int force) |
1da177e4 | 261 | { |
7f0536f8 | 262 | pgd_t *pgd; |
1466abf2 | 263 | struct host_vm_change hvc; |
7f0536f8 | 264 | unsigned long addr = start_addr, next; |
1466abf2 | 265 | int ret = 0; |
1da177e4 | 266 | |
1466abf2 | 267 | hvc = INIT_HVC(mm, force); |
7f0536f8 JD |
268 | pgd = pgd_offset(mm, addr); |
269 | do { | |
270 | next = pgd_addr_end(addr, end_addr); | |
ba180fd4 JD |
271 | if (!pgd_present(*pgd)) { |
272 | if (force || pgd_newpage(*pgd)) { | |
1466abf2 | 273 | ret = add_munmap(addr, next - addr, &hvc); |
7f0536f8 | 274 | pgd_mkuptodate(*pgd); |
5e1f65a6 | 275 | } |
5e1f65a6 | 276 | } |
1466abf2 | 277 | else ret = update_pud_range(pgd, addr, next, &hvc); |
909e90d3 | 278 | } while (pgd++, addr = next, ((addr < end_addr) && !ret)); |
5e1f65a6 | 279 | |
ba180fd4 | 280 | if (!ret) |
1466abf2 | 281 | ret = do_ops(&hvc, hvc.index, 1); |
07bf731e | 282 | |
7f0536f8 | 283 | /* This is not an else because ret is modified above */ |
ba180fd4 JD |
284 | if (ret) { |
285 | printk(KERN_ERR "fix_range_common: failed, killing current " | |
286 | "process\n"); | |
07bf731e BS |
287 | force_sig(SIGKILL, current); |
288 | } | |
1da177e4 LT |
289 | } |
290 | ||
c75d053b | 291 | static int flush_tlb_kernel_range_common(unsigned long start, unsigned long end) |
1da177e4 | 292 | { |
5e1f65a6 JD |
293 | struct mm_struct *mm; |
294 | pgd_t *pgd; | |
295 | pud_t *pud; | |
296 | pmd_t *pmd; | |
297 | pte_t *pte; | |
298 | unsigned long addr, last; | |
299 | int updated = 0, err; | |
300 | ||
301 | mm = &init_mm; | |
ba180fd4 | 302 | for (addr = start; addr < end;) { |
5e1f65a6 | 303 | pgd = pgd_offset(mm, addr); |
ba180fd4 | 304 | if (!pgd_present(*pgd)) { |
5e1f65a6 | 305 | last = ADD_ROUND(addr, PGDIR_SIZE); |
ba180fd4 | 306 | if (last > end) |
5e1f65a6 | 307 | last = end; |
ba180fd4 | 308 | if (pgd_newpage(*pgd)) { |
5e1f65a6 JD |
309 | updated = 1; |
310 | err = os_unmap_memory((void *) addr, | |
311 | last - addr); | |
ba180fd4 | 312 | if (err < 0) |
5e1f65a6 JD |
313 | panic("munmap failed, errno = %d\n", |
314 | -err); | |
315 | } | |
316 | addr = last; | |
317 | continue; | |
318 | } | |
319 | ||
320 | pud = pud_offset(pgd, addr); | |
ba180fd4 | 321 | if (!pud_present(*pud)) { |
5e1f65a6 | 322 | last = ADD_ROUND(addr, PUD_SIZE); |
ba180fd4 | 323 | if (last > end) |
5e1f65a6 | 324 | last = end; |
ba180fd4 | 325 | if (pud_newpage(*pud)) { |
5e1f65a6 JD |
326 | updated = 1; |
327 | err = os_unmap_memory((void *) addr, | |
328 | last - addr); | |
ba180fd4 | 329 | if (err < 0) |
5e1f65a6 JD |
330 | panic("munmap failed, errno = %d\n", |
331 | -err); | |
332 | } | |
333 | addr = last; | |
334 | continue; | |
335 | } | |
336 | ||
337 | pmd = pmd_offset(pud, addr); | |
ba180fd4 | 338 | if (!pmd_present(*pmd)) { |
5e1f65a6 | 339 | last = ADD_ROUND(addr, PMD_SIZE); |
ba180fd4 | 340 | if (last > end) |
5e1f65a6 | 341 | last = end; |
ba180fd4 | 342 | if (pmd_newpage(*pmd)) { |
5e1f65a6 JD |
343 | updated = 1; |
344 | err = os_unmap_memory((void *) addr, | |
345 | last - addr); | |
ba180fd4 | 346 | if (err < 0) |
5e1f65a6 JD |
347 | panic("munmap failed, errno = %d\n", |
348 | -err); | |
349 | } | |
350 | addr = last; | |
351 | continue; | |
352 | } | |
353 | ||
354 | pte = pte_offset_kernel(pmd, addr); | |
ba180fd4 | 355 | if (!pte_present(*pte) || pte_newpage(*pte)) { |
5e1f65a6 JD |
356 | updated = 1; |
357 | err = os_unmap_memory((void *) addr, | |
358 | PAGE_SIZE); | |
ba180fd4 | 359 | if (err < 0) |
5e1f65a6 JD |
360 | panic("munmap failed, errno = %d\n", |
361 | -err); | |
ba180fd4 | 362 | if (pte_present(*pte)) |
5e1f65a6 JD |
363 | map_memory(addr, |
364 | pte_val(*pte) & PAGE_MASK, | |
365 | PAGE_SIZE, 1, 1, 1); | |
366 | } | |
ba180fd4 | 367 | else if (pte_newprot(*pte)) { |
5e1f65a6 JD |
368 | updated = 1; |
369 | os_protect_memory((void *) addr, PAGE_SIZE, 1, 1, 1); | |
370 | } | |
371 | addr += PAGE_SIZE; | |
372 | } | |
ba180fd4 | 373 | return updated; |
1da177e4 LT |
374 | } |
375 | ||
77bf4400 JD |
376 | void flush_tlb_page(struct vm_area_struct *vma, unsigned long address) |
377 | { | |
378 | pgd_t *pgd; | |
379 | pud_t *pud; | |
380 | pmd_t *pmd; | |
381 | pte_t *pte; | |
382 | struct mm_struct *mm = vma->vm_mm; | |
383 | void *flush = NULL; | |
384 | int r, w, x, prot, err = 0; | |
385 | struct mm_id *mm_id; | |
386 | ||
387 | address &= PAGE_MASK; | |
388 | pgd = pgd_offset(mm, address); | |
ba180fd4 | 389 | if (!pgd_present(*pgd)) |
77bf4400 JD |
390 | goto kill; |
391 | ||
392 | pud = pud_offset(pgd, address); | |
ba180fd4 | 393 | if (!pud_present(*pud)) |
77bf4400 JD |
394 | goto kill; |
395 | ||
396 | pmd = pmd_offset(pud, address); | |
ba180fd4 | 397 | if (!pmd_present(*pmd)) |
77bf4400 JD |
398 | goto kill; |
399 | ||
400 | pte = pte_offset_kernel(pmd, address); | |
401 | ||
402 | r = pte_read(*pte); | |
403 | w = pte_write(*pte); | |
404 | x = pte_exec(*pte); | |
405 | if (!pte_young(*pte)) { | |
406 | r = 0; | |
407 | w = 0; | |
408 | } else if (!pte_dirty(*pte)) { | |
409 | w = 0; | |
410 | } | |
411 | ||
6c738ffa | 412 | mm_id = &mm->context.id; |
77bf4400 JD |
413 | prot = ((r ? UM_PROT_READ : 0) | (w ? UM_PROT_WRITE : 0) | |
414 | (x ? UM_PROT_EXEC : 0)); | |
ba180fd4 JD |
415 | if (pte_newpage(*pte)) { |
416 | if (pte_present(*pte)) { | |
77bf4400 JD |
417 | unsigned long long offset; |
418 | int fd; | |
419 | ||
420 | fd = phys_mapping(pte_val(*pte) & PAGE_MASK, &offset); | |
421 | err = map(mm_id, address, PAGE_SIZE, prot, fd, offset, | |
422 | 1, &flush); | |
423 | } | |
424 | else err = unmap(mm_id, address, PAGE_SIZE, 1, &flush); | |
425 | } | |
ba180fd4 | 426 | else if (pte_newprot(*pte)) |
77bf4400 JD |
427 | err = protect(mm_id, address, PAGE_SIZE, prot, 1, &flush); |
428 | ||
ba180fd4 | 429 | if (err) |
77bf4400 JD |
430 | goto kill; |
431 | ||
432 | *pte = pte_mkuptodate(*pte); | |
433 | ||
434 | return; | |
435 | ||
436 | kill: | |
ba180fd4 | 437 | printk(KERN_ERR "Failed to flush page for address 0x%lx\n", address); |
77bf4400 JD |
438 | force_sig(SIGKILL, current); |
439 | } | |
440 | ||
1da177e4 LT |
441 | pgd_t *pgd_offset_proc(struct mm_struct *mm, unsigned long address) |
442 | { | |
ba180fd4 | 443 | return pgd_offset(mm, address); |
1da177e4 LT |
444 | } |
445 | ||
446 | pud_t *pud_offset_proc(pgd_t *pgd, unsigned long address) | |
447 | { | |
ba180fd4 | 448 | return pud_offset(pgd, address); |
1da177e4 LT |
449 | } |
450 | ||
451 | pmd_t *pmd_offset_proc(pud_t *pud, unsigned long address) | |
452 | { | |
ba180fd4 | 453 | return pmd_offset(pud, address); |
1da177e4 LT |
454 | } |
455 | ||
456 | pte_t *pte_offset_proc(pmd_t *pmd, unsigned long address) | |
457 | { | |
ba180fd4 | 458 | return pte_offset_kernel(pmd, address); |
1da177e4 LT |
459 | } |
460 | ||
461 | pte_t *addr_pte(struct task_struct *task, unsigned long addr) | |
462 | { | |
5e1f65a6 JD |
463 | pgd_t *pgd = pgd_offset(task->mm, addr); |
464 | pud_t *pud = pud_offset(pgd, addr); | |
465 | pmd_t *pmd = pmd_offset(pud, addr); | |
1da177e4 | 466 | |
ba180fd4 | 467 | return pte_offset_map(pmd, addr); |
1da177e4 LT |
468 | } |
469 | ||
d67b569f JD |
470 | void flush_tlb_all(void) |
471 | { | |
5e1f65a6 | 472 | flush_tlb_mm(current->mm); |
d67b569f JD |
473 | } |
474 | ||
475 | void flush_tlb_kernel_range(unsigned long start, unsigned long end) | |
476 | { | |
6aa802ce | 477 | flush_tlb_kernel_range_common(start, end); |
d67b569f JD |
478 | } |
479 | ||
480 | void flush_tlb_kernel_vm(void) | |
481 | { | |
6aa802ce | 482 | flush_tlb_kernel_range_common(start_vm, end_vm); |
d67b569f JD |
483 | } |
484 | ||
485 | void __flush_tlb_one(unsigned long addr) | |
486 | { | |
ba180fd4 | 487 | flush_tlb_kernel_range_common(addr, addr + PAGE_SIZE); |
77bf4400 JD |
488 | } |
489 | ||
77bf4400 JD |
490 | static void fix_range(struct mm_struct *mm, unsigned long start_addr, |
491 | unsigned long end_addr, int force) | |
492 | { | |
1466abf2 | 493 | fix_range_common(mm, start_addr, end_addr, force); |
d67b569f JD |
494 | } |
495 | ||
496 | void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, | |
497 | unsigned long end) | |
498 | { | |
ba180fd4 JD |
499 | if (vma->vm_mm == NULL) |
500 | flush_tlb_kernel_range_common(start, end); | |
501 | else fix_range(vma->vm_mm, start, end, 0); | |
d67b569f | 502 | } |
73395a00 | 503 | EXPORT_SYMBOL(flush_tlb_range); |
d67b569f | 504 | |
0b4e273f JD |
505 | void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start, |
506 | unsigned long end) | |
d67b569f | 507 | { |
ba180fd4 JD |
508 | /* |
509 | * Don't bother flushing if this address space is about to be | |
510 | * destroyed. | |
511 | */ | |
512 | if (atomic_read(&mm->mm_users) == 0) | |
513 | return; | |
77bf4400 | 514 | |
0b4e273f JD |
515 | fix_range(mm, start, end, 0); |
516 | } | |
517 | ||
518 | void flush_tlb_mm(struct mm_struct *mm) | |
519 | { | |
520 | struct vm_area_struct *vma = mm->mmap; | |
521 | ||
522 | while (vma != NULL) { | |
523 | fix_range(mm, vma->vm_start, vma->vm_end, 0); | |
524 | vma = vma->vm_next; | |
525 | } | |
d67b569f JD |
526 | } |
527 | ||
528 | void force_flush_all(void) | |
529 | { | |
77bf4400 JD |
530 | struct mm_struct *mm = current->mm; |
531 | struct vm_area_struct *vma = mm->mmap; | |
532 | ||
ba180fd4 | 533 | while (vma != NULL) { |
77bf4400 JD |
534 | fix_range(mm, vma->vm_start, vma->vm_end, 1); |
535 | vma = vma->vm_next; | |
536 | } | |
d67b569f | 537 | } |