root/include/asm-alpha/page.h

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

INCLUDED FROM


   1 #ifndef _ALPHA_PAGE_H
   2 #define _ALPHA_PAGE_H
   3 
   4 #define invalidate_all() \
   5 __asm__ __volatile__( \
   6         "lda $16,-2($31)\n\t" \
   7         ".long 51" \
   8         : : :"$1", "$16", "$17", "$22","$23","$24","$25")
   9 
  10 #define invalidate() \
  11 __asm__ __volatile__( \
  12         "lda $16,-1($31)\n\t" \
  13         ".long 51" \
  14         : : :"$1", "$16", "$17", "$22","$23","$24","$25")
  15 
  16 /* PAGE_SHIFT determines the page size */
  17 #define PAGE_SHIFT                      13
  18 #define PGDIR_SHIFT                     23
  19 #define PAGE_SIZE                       (1UL << PAGE_SHIFT)
  20 #define PGDIR_SIZE                      (1UL << PGDIR_SHIFT)
  21 
  22 #define PAGE_OFFSET 0xFFFFFC0000000000
  23 #define MAP_NR(addr) (((addr) - PAGE_OFFSET) >> PAGE_SHIFT)
  24 #define MAP_PAGE_RESERVED (1<<31)
  25 
  26 typedef unsigned int mem_map_t;
  27 
  28 #define PAGE_PRESENT    0x001
  29 #define PAGE_RW         0x002
  30 #define PAGE_USER       0x004
  31 #define PAGE_ACCESSED   0x020
  32 #define PAGE_DIRTY      0x040
  33 #define PAGE_COW        0x200   /* implemented in software (one of the AVL bits) */
  34 
  35 #define PAGE_PRIVATE    (PAGE_PRESENT | PAGE_RW | PAGE_USER | PAGE_ACCESSED | PAGE_COW)
  36 #define PAGE_SHARED     (PAGE_PRESENT | PAGE_RW | PAGE_USER | PAGE_ACCESSED)
  37 #define PAGE_COPY       (PAGE_PRESENT | PAGE_USER | PAGE_ACCESSED | PAGE_COW)
  38 #define PAGE_READONLY   (PAGE_PRESENT | PAGE_USER | PAGE_ACCESSED)
  39 #define PAGE_EXECONLY   (PAGE_PRESENT | PAGE_USER | PAGE_ACCESSED)
  40 #define PAGE_TABLE      (PAGE_PRESENT | PAGE_RW | PAGE_USER | PAGE_ACCESSED)
  41 
  42 #define PAGE_CHG_MASK (PAGE_MASK | PAGE_ACCESSED | PAGE_DIRTY)
  43 
  44 #ifdef __KERNEL__
  45 
  46 /*
  47  * BAD_PAGETABLE is used when we need a bogus page-table, while
  48  * BAD_PAGE is used for a bogus page.
  49  *
  50  * ZERO_PAGE is a global shared page that is always zero: used
  51  * for zero-mapped memory areas etc..
  52  */
  53 extern unsigned long __bad_page(void);
  54 extern unsigned long __bad_pagetable(void);
  55 extern unsigned long __zero_page(void);
  56 
  57 #define BAD_PAGETABLE __bad_pagetable()
  58 #define BAD_PAGE __bad_page()
  59 #define ZERO_PAGE __zero_page()
  60 
  61 /* number of bits that fit into a memory pointer */
  62 #define BITS_PER_PTR                    (8*sizeof(unsigned long))
  63 
  64 /* to mask away the intra-page address bits */
  65 #define PAGE_MASK                       (~(PAGE_SIZE-1))
  66 
  67 /* to mask away the intra-page address bits */
  68 #define PGDIR_MASK                      (~(PGDIR_SIZE-1))
  69 
  70 /* to align the pointer to the (next) page boundary */
  71 #define PAGE_ALIGN(addr)                (((addr)+PAGE_SIZE-1)&PAGE_MASK)
  72 
  73 /* to align the pointer to a pointer address */
  74 #define PTR_MASK                        (~(sizeof(void*)-1))
  75 
  76 /* sizeof(void*)==1<<SIZEOF_PTR_LOG2 */
  77 /* 64-bit machines, beware!  SRB. */
  78 #define SIZEOF_PTR_LOG2                 3
  79 
  80 /* to find an entry in a page-table-directory */
  81 /*
  82  * XXXXX This isn't right: we shouldn't use the ptbr, but the L2 pointer.
  83  * This is just for getting it through the compiler right now
  84  */
  85 #define PAGE_DIR_OFFSET(tsk,address) \
  86 ((unsigned long *) ((tsk)->tss.ptbr + ((((unsigned long)(address)) >> 21) & PTR_MASK & ~PAGE_MASK)))
  87 
  88 /* to find an entry in a page-table */
  89 #define PAGE_PTR(address)               \
  90   ((unsigned long)(address)>>(PAGE_SHIFT-SIZEOF_PTR_LOG2)&PTR_MASK&~PAGE_MASK)
  91 
  92 /* the no. of pointers that fit on a page */
  93 #define PTRS_PER_PAGE                   (PAGE_SIZE/sizeof(void*))
  94 
  95 /* to set the page-dir */
  96 /*
  97  * XXXXX This isn't right: we shouldn't use the ptbr, but the L2 pointer.
  98  * This is just for getting it through the compiler right now
  99  */
 100 #define SET_PAGE_DIR(tsk,pgdir) \
 101 do { \
 102         (tsk)->tss.ptbr = (unsigned long) (pgdir); \
 103         if ((tsk) == current) \
 104                 invalidate(); \
 105 } while (0)
 106 
 107 #endif /* __KERNEL__ */
 108 
 109 #endif /* _ALPHA_PAGE_H */

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