root/include/linux/page.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 #ifndef _LINUX_PAGE_H
   2 #define _LINUX_PAGE_H
   3 
   4                         /* PAGE_SHIFT determines the page size */
   5 #define PAGE_SHIFT                      12
   6 #define PGDIR_SHIFT                     22
   7 #define PAGE_SIZE                       (1UL << PAGE_SHIFT)
   8 #define PGDIR_SIZE                      (1UL << PGDIR_SHIFT)
   9 
  10 #ifdef __KERNEL__
  11 
  12                         /* number of bits that fit into a memory pointer */
  13 #define BITS_PER_PTR                    (8*sizeof(unsigned long))
  14                         /* to mask away the intra-page address bits */
  15 #define PAGE_MASK                       (~(PAGE_SIZE-1))
  16                         /* to mask away the intra-page address bits */
  17 #define PGDIR_MASK                      (~(PGDIR_SIZE-1))
  18                         /* to align the pointer to the (next) page boundary */
  19 #define PAGE_ALIGN(addr)                (((addr)+PAGE_SIZE-1)&PAGE_MASK)
  20                         /* to align the pointer to a pointer address */
  21 #define PTR_MASK                        (~(sizeof(void*)-1))
  22 
  23                                         /* sizeof(void*)==1<<SIZEOF_PTR_LOG2 */
  24                                         /* 64-bit machines, beware!  SRB. */
  25 #define SIZEOF_PTR_LOG2                 2
  26 
  27                         /* to find an entry in a page-table-directory */
  28 #define PAGE_DIR_OFFSET(base,address)   ((unsigned long*)((base)+\
  29   ((unsigned long)(address)>>(PAGE_SHIFT-SIZEOF_PTR_LOG2)*2&PTR_MASK&~PAGE_MASK)))
  30                         /* to find an entry in a page-table */
  31 #define PAGE_PTR(address)               \
  32   ((unsigned long)(address)>>(PAGE_SHIFT-SIZEOF_PTR_LOG2)&PTR_MASK&~PAGE_MASK)
  33                         /* the no. of pointers that fit on a page */
  34 #define PTRS_PER_PAGE                   (PAGE_SIZE/sizeof(void*))
  35 
  36 #endif /* __KERNEL__ */
  37 
  38 #endif /* _LINUX_PAGE_H */

/* [previous][next][first][last][top][bottom][index][help] */