diff options
Diffstat (limited to 'include/asm-x86/pgtable.h')
-rw-r--r-- | include/asm-x86/pgtable.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/asm-x86/pgtable.h b/include/asm-x86/pgtable.h index 1330e7487da1..85f851a0b998 100644 --- a/include/asm-x86/pgtable.h +++ b/include/asm-x86/pgtable.h | |||
@@ -357,6 +357,26 @@ void set_pte_vaddr(unsigned long vaddr, pte_t pte); | |||
357 | # include "pgtable_64.h" | 357 | # include "pgtable_64.h" |
358 | #endif | 358 | #endif |
359 | 359 | ||
360 | /* | ||
361 | * the pgd page can be thought of an array like this: pgd_t[PTRS_PER_PGD] | ||
362 | * | ||
363 | * this macro returns the index of the entry in the pgd page which would | ||
364 | * control the given virtual address | ||
365 | */ | ||
366 | #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1)) | ||
367 | |||
368 | /* | ||
369 | * pgd_offset() returns a (pgd_t *) | ||
370 | * pgd_index() is used get the offset into the pgd page's array of pgd_t's; | ||
371 | */ | ||
372 | #define pgd_offset(mm, address) ((mm)->pgd + pgd_index((address))) | ||
373 | /* | ||
374 | * a shortcut which implies the use of the kernel's pgd, instead | ||
375 | * of a process's | ||
376 | */ | ||
377 | #define pgd_offset_k(address) pgd_offset(&init_mm, (address)) | ||
378 | |||
379 | |||
360 | #define KERNEL_PGD_BOUNDARY pgd_index(PAGE_OFFSET) | 380 | #define KERNEL_PGD_BOUNDARY pgd_index(PAGE_OFFSET) |
361 | #define KERNEL_PGD_PTRS (PTRS_PER_PGD - KERNEL_PGD_BOUNDARY) | 381 | #define KERNEL_PGD_PTRS (PTRS_PER_PGD - KERNEL_PGD_BOUNDARY) |
362 | 382 | ||