diff options
Diffstat (limited to 'include/asm-x86/pgtable.h')
-rw-r--r-- | include/asm-x86/pgtable.h | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/include/asm-x86/pgtable.h b/include/asm-x86/pgtable.h index 1902f0aed6c1..a496d6335d3b 100644 --- a/include/asm-x86/pgtable.h +++ b/include/asm-x86/pgtable.h | |||
@@ -1,7 +1,6 @@ | |||
1 | #ifndef _ASM_X86_PGTABLE_H | 1 | #ifndef _ASM_X86_PGTABLE_H |
2 | #define _ASM_X86_PGTABLE_H | 2 | #define _ASM_X86_PGTABLE_H |
3 | 3 | ||
4 | #define USER_PTRS_PER_PGD ((TASK_SIZE-1)/PGDIR_SIZE+1) | ||
5 | #define FIRST_USER_ADDRESS 0 | 4 | #define FIRST_USER_ADDRESS 0 |
6 | 5 | ||
7 | #define _PAGE_BIT_PRESENT 0 /* is present */ | 6 | #define _PAGE_BIT_PRESENT 0 /* is present */ |
@@ -339,6 +338,9 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn, | |||
339 | # include "pgtable_64.h" | 338 | # include "pgtable_64.h" |
340 | #endif | 339 | #endif |
341 | 340 | ||
341 | #define KERNEL_PGD_BOUNDARY pgd_index(PAGE_OFFSET) | ||
342 | #define KERNEL_PGD_PTRS (PTRS_PER_PGD - KERNEL_PGD_BOUNDARY) | ||
343 | |||
342 | #ifndef __ASSEMBLY__ | 344 | #ifndef __ASSEMBLY__ |
343 | 345 | ||
344 | enum { | 346 | enum { |
@@ -398,37 +400,17 @@ static inline void native_set_pte_at(struct mm_struct *mm, unsigned long addr, | |||
398 | * bit at the same time. | 400 | * bit at the same time. |
399 | */ | 401 | */ |
400 | #define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS | 402 | #define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS |
401 | #define ptep_set_access_flags(vma, address, ptep, entry, dirty) \ | 403 | extern int ptep_set_access_flags(struct vm_area_struct *vma, |
402 | ({ \ | 404 | unsigned long address, pte_t *ptep, |
403 | int __changed = !pte_same(*(ptep), entry); \ | 405 | pte_t entry, int dirty); |
404 | if (__changed && dirty) { \ | ||
405 | *ptep = entry; \ | ||
406 | pte_update_defer((vma)->vm_mm, (address), (ptep)); \ | ||
407 | flush_tlb_page(vma, address); \ | ||
408 | } \ | ||
409 | __changed; \ | ||
410 | }) | ||
411 | 406 | ||
412 | #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG | 407 | #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG |
413 | #define ptep_test_and_clear_young(vma, addr, ptep) ({ \ | 408 | extern int ptep_test_and_clear_young(struct vm_area_struct *vma, |
414 | int __ret = 0; \ | 409 | unsigned long addr, pte_t *ptep); |
415 | if (pte_young(*(ptep))) \ | ||
416 | __ret = test_and_clear_bit(_PAGE_BIT_ACCESSED, \ | ||
417 | &(ptep)->pte); \ | ||
418 | if (__ret) \ | ||
419 | pte_update((vma)->vm_mm, addr, ptep); \ | ||
420 | __ret; \ | ||
421 | }) | ||
422 | 410 | ||
423 | #define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH | 411 | #define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH |
424 | #define ptep_clear_flush_young(vma, address, ptep) \ | 412 | extern int ptep_clear_flush_young(struct vm_area_struct *vma, |
425 | ({ \ | 413 | unsigned long address, pte_t *ptep); |
426 | int __young; \ | ||
427 | __young = ptep_test_and_clear_young((vma), (address), (ptep)); \ | ||
428 | if (__young) \ | ||
429 | flush_tlb_page(vma, address); \ | ||
430 | __young; \ | ||
431 | }) | ||
432 | 414 | ||
433 | #define __HAVE_ARCH_PTEP_GET_AND_CLEAR | 415 | #define __HAVE_ARCH_PTEP_GET_AND_CLEAR |
434 | static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, | 416 | static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, |
@@ -465,6 +447,22 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, | |||
465 | pte_update(mm, addr, ptep); | 447 | pte_update(mm, addr, ptep); |
466 | } | 448 | } |
467 | 449 | ||
450 | /* | ||
451 | * clone_pgd_range(pgd_t *dst, pgd_t *src, int count); | ||
452 | * | ||
453 | * dst - pointer to pgd range anwhere on a pgd page | ||
454 | * src - "" | ||
455 | * count - the number of pgds to copy. | ||
456 | * | ||
457 | * dst and src can be on the same page, but the range must not overlap, | ||
458 | * and must not cross a page boundary. | ||
459 | */ | ||
460 | static inline void clone_pgd_range(pgd_t *dst, pgd_t *src, int count) | ||
461 | { | ||
462 | memcpy(dst, src, count * sizeof(pgd_t)); | ||
463 | } | ||
464 | |||
465 | |||
468 | #include <asm-generic/pgtable.h> | 466 | #include <asm-generic/pgtable.h> |
469 | #endif /* __ASSEMBLY__ */ | 467 | #endif /* __ASSEMBLY__ */ |
470 | 468 | ||