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

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