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 #defineinvalidate() \
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 #definePAGE_SHIFT 13
18 #definePGDIR_SHIFT 23
19 #definePAGE_SIZE (1UL << PAGE_SHIFT)
20 #definePGDIR_SIZE (1UL << PGDIR_SHIFT)
21
22 #ifdef__KERNEL__ 23
24 /* number of bits that fit into a memory pointer */ 25 #define BITS_PER_PTR (8*sizeof(unsignedlong))
26 /* to mask away the intra-page address bits */ 27 #definePAGE_MASK (~(PAGE_SIZE-1))
28 /* to mask away the intra-page address bits */ 29 #definePGDIR_MASK (~(PGDIR_SIZE-1))
30 /* to align the pointer to the (next) page boundary */ 31 #definePAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
32 /* to align the pointer to a pointer address */ 33 #definePTR_MASK (~(sizeof(void*)-1))
34
35 /* sizeof(void*)==1<<SIZEOF_PTR_LOG2 */ 36 /* 64-bit machines, beware! SRB. */ 37 #defineSIZEOF_PTR_LOG2 4
38
39 /* to find an entry in a page-table-directory */ 40 /* 41 * XXXXX This isn't right: we shouldn't use the ptbr, but the L2 pointer. 42 * This is just for getting it through the compiler right now 43 */ 44 #definePAGE_DIR_OFFSET(tsk,address) \
45 ((unsignedlong *) ((tsk)->tss.ptbr + ((((unsignedlong)(address)) >> 21) & PTR_MASK & ~PAGE_MASK)))
46
47 /* to find an entry in a page-table */ 48 #definePAGE_PTR(address) \
49 ((unsignedlong)(address)>>(PAGE_SHIFT-SIZEOF_PTR_LOG2)&PTR_MASK&~PAGE_MASK)
50
51 /* the no. of pointers that fit on a page */ 52 #definePTRS_PER_PAGE (PAGE_SIZE/sizeof(void*))
53
54 /* to set the page-dir */ 55 /* 56 * XXXXX This isn't right: we shouldn't use the ptbr, but the L2 pointer. 57 * This is just for getting it through the compiler right now 58 */ 59 #defineSET_PAGE_DIR(tsk,pgdir) \
60 do{ \
61 (tsk)->tss.ptbr = (unsignedlong) (pgdir); \
62 if ((tsk) == current) \
63 invalidate(); \
64 }while (0)
65
66 #endif/* __KERNEL__ */ 67
68 #endif/* _ALPHA_PAGE_H */