root/include/asm-mips/page.h

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

INCLUDED FROM


   1 #ifndef __ASM_MIPS_PAGE_H
   2 #define __ASM_MIPS_PAGE_H
   3 
   4 #include <linux/linkage.h>
   5 
   6 #ifndef __ASSEMBLY__
   7 #define invalidate()    tlbflush();
   8 extern asmlinkage void tlbflush(void);
   9 #endif
  10 
  11                         /* PAGE_SHIFT determines the page size */
  12 #define PAGE_SHIFT                      12
  13 #define PGDIR_SHIFT                     22
  14 #define PAGE_SIZE                       (1UL << PAGE_SHIFT)
  15 #define PGDIR_SIZE                      (1UL << PGDIR_SHIFT)
  16 
  17 #ifdef __KERNEL__
  18 
  19                         /* number of bits that fit into a memory pointer */
  20 #define BITS_PER_PTR                    (8*sizeof(unsigned long))
  21                         /* to mask away the intra-page address bits */
  22 #define PAGE_MASK                       (~(PAGE_SIZE-1))
  23                         /* to mask away the intra-page address bits */
  24 #define PGDIR_MASK                      (~(PGDIR_SIZE-1))
  25                         /* to align the pointer to the (next) page boundary */
  26 #define PAGE_ALIGN(addr)                (((addr)+PAGE_SIZE-1)&PAGE_MASK)
  27                         /* to align the pointer to a pointer address */
  28 #define PTR_MASK                        (~(sizeof(void*)-1))
  29 
  30                                         /* sizeof(void*)==1<<SIZEOF_PTR_LOG2 */
  31                                         /* 64-bit machines, beware!  SRB. */
  32 #define SIZEOF_PTR_LOG2                 2
  33 
  34 /* to find an entry in a page-table-directory */
  35 #define PAGE_DIR_OFFSET(tsk,address) \
  36 ((((unsigned long)(address)) >> 22) + (unsigned long *) (tsk)->tss.pg_dir)
  37 
  38 /* to find an entry in a page-table */
  39 #define PAGE_PTR(address)               \
  40 ((unsigned long)(address)>>(PAGE_SHIFT-SIZEOF_PTR_LOG2)&PTR_MASK&~PAGE_MASK)
  41 
  42 /* the no. of pointers that fit on a page */
  43 #define PTRS_PER_PAGE                   (PAGE_SIZE/sizeof(void*))
  44 
  45 /* to set the page-dir */
  46 #define SET_PAGE_DIR(tsk,pgdir) \
  47 do { \
  48         (tsk)->tss.pg_dir = (unsigned long) (pgdir); \
  49         if ((tsk) == current) \
  50                 invalidate(); \
  51 } while (0)
  52 
  53 #endif /* __KERNEL__ */
  54 
  55 #endif /* __ASM_MIPS_PAGE_H */

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