diff options
Diffstat (limited to 'include/asm-x86/pgtable.h')
-rw-r--r-- | include/asm-x86/pgtable.h | 63 |
1 files changed, 35 insertions, 28 deletions
diff --git a/include/asm-x86/pgtable.h b/include/asm-x86/pgtable.h index f1d9f4a03f6f..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 */ |
@@ -289,6 +288,15 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | |||
289 | 288 | ||
290 | #define canon_pgprot(p) __pgprot(pgprot_val(p) & __supported_pte_mask) | 289 | #define canon_pgprot(p) __pgprot(pgprot_val(p) & __supported_pte_mask) |
291 | 290 | ||
291 | #ifndef __ASSEMBLY__ | ||
292 | #define __HAVE_PHYS_MEM_ACCESS_PROT | ||
293 | struct file; | ||
294 | pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, | ||
295 | unsigned long size, pgprot_t vma_prot); | ||
296 | int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn, | ||
297 | unsigned long size, pgprot_t *vma_prot); | ||
298 | #endif | ||
299 | |||
292 | #ifdef CONFIG_PARAVIRT | 300 | #ifdef CONFIG_PARAVIRT |
293 | #include <asm/paravirt.h> | 301 | #include <asm/paravirt.h> |
294 | #else /* !CONFIG_PARAVIRT */ | 302 | #else /* !CONFIG_PARAVIRT */ |
@@ -330,6 +338,9 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | |||
330 | # include "pgtable_64.h" | 338 | # include "pgtable_64.h" |
331 | #endif | 339 | #endif |
332 | 340 | ||
341 | #define KERNEL_PGD_BOUNDARY pgd_index(PAGE_OFFSET) | ||
342 | #define KERNEL_PGD_PTRS (PTRS_PER_PGD - KERNEL_PGD_BOUNDARY) | ||
343 | |||
333 | #ifndef __ASSEMBLY__ | 344 | #ifndef __ASSEMBLY__ |
334 | 345 | ||
335 | enum { | 346 | enum { |
@@ -389,37 +400,17 @@ static inline void native_set_pte_at(struct mm_struct *mm, unsigned long addr, | |||
389 | * bit at the same time. | 400 | * bit at the same time. |
390 | */ | 401 | */ |
391 | #define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS | 402 | #define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS |
392 | #define ptep_set_access_flags(vma, address, ptep, entry, dirty) \ | 403 | extern int ptep_set_access_flags(struct vm_area_struct *vma, |
393 | ({ \ | 404 | unsigned long address, pte_t *ptep, |
394 | int __changed = !pte_same(*(ptep), entry); \ | 405 | pte_t entry, int dirty); |
395 | if (__changed && dirty) { \ | ||
396 | *ptep = entry; \ | ||
397 | pte_update_defer((vma)->vm_mm, (address), (ptep)); \ | ||
398 | flush_tlb_page(vma, address); \ | ||
399 | } \ | ||
400 | __changed; \ | ||
401 | }) | ||
402 | 406 | ||
403 | #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG | 407 | #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG |
404 | #define ptep_test_and_clear_young(vma, addr, ptep) ({ \ | 408 | extern int ptep_test_and_clear_young(struct vm_area_struct *vma, |
405 | int __ret = 0; \ | 409 | unsigned long addr, pte_t *ptep); |
406 | if (pte_young(*(ptep))) \ | ||
407 | __ret = test_and_clear_bit(_PAGE_BIT_ACCESSED, \ | ||
408 | &(ptep)->pte); \ | ||
409 | if (__ret) \ | ||
410 | pte_update((vma)->vm_mm, addr, ptep); \ | ||
411 | __ret; \ | ||
412 | }) | ||
413 | 410 | ||
414 | #define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH | 411 | #define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH |
415 | #define ptep_clear_flush_young(vma, address, ptep) \ | 412 | extern int ptep_clear_flush_young(struct vm_area_struct *vma, |
416 | ({ \ | 413 | unsigned long address, pte_t *ptep); |
417 | int __young; \ | ||
418 | __young = ptep_test_and_clear_young((vma), (address), (ptep)); \ | ||
419 | if (__young) \ | ||
420 | flush_tlb_page(vma, address); \ | ||
421 | __young; \ | ||
422 | }) | ||
423 | 414 | ||
424 | #define __HAVE_ARCH_PTEP_GET_AND_CLEAR | 415 | #define __HAVE_ARCH_PTEP_GET_AND_CLEAR |
425 | 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, |
@@ -456,6 +447,22 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, | |||
456 | pte_update(mm, addr, ptep); | 447 | pte_update(mm, addr, ptep); |
457 | } | 448 | } |
458 | 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 | |||
459 | #include <asm-generic/pgtable.h> | 466 | #include <asm-generic/pgtable.h> |
460 | #endif /* __ASSEMBLY__ */ | 467 | #endif /* __ASSEMBLY__ */ |
461 | 468 | ||