root/include/asm-i386/page.h

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

INCLUDED FROM


   1 #ifndef _I386_PAGE_H
   2 #define _I386_PAGE_H
   3 
   4 /* PAGE_SHIFT determines the page size */
   5 #define PAGE_SHIFT      12
   6 #define PAGE_SIZE       (1UL << PAGE_SHIFT)
   7 #define PAGE_MASK       (~(PAGE_SIZE-1))
   8 
   9 #ifdef __KERNEL__
  10 
  11 #define STRICT_MM_TYPECHECKS
  12 
  13 #ifdef STRICT_MM_TYPECHECKS
  14 /*
  15  * These are used to make use of C type-checking..
  16  */
  17 typedef struct { unsigned long pte; } pte_t;
  18 typedef struct { unsigned long pmd; } pmd_t;
  19 typedef struct { unsigned long pgd; } pgd_t;
  20 typedef struct { unsigned long pgprot; } pgprot_t;
  21 
  22 #define pte_val(x)      ((x).pte)
  23 #define pmd_val(x)      ((x).pmd)
  24 #define pgd_val(x)      ((x).pgd)
  25 #define pgprot_val(x)   ((x).pgprot)
  26 
  27 #define __pte(x)        ((pte_t) { (x) } )
  28 #define __pmd(x)        ((pmd_t) { (x) } )
  29 #define __pgd(x)        ((pgd_t) { (x) } )
  30 #define __pgprot(x)     ((pgprot_t) { (x) } )
  31 
  32 #else
  33 /*
  34  * .. while these make it easier on the compiler
  35  */
  36 typedef unsigned long pte_t;
  37 typedef unsigned long pmd_t;
  38 typedef unsigned long pgd_t;
  39 typedef unsigned long pgprot_t;
  40 
  41 #define pte_val(x)      (x)
  42 #define pmd_val(x)      (x)
  43 #define pgd_val(x)      (x)
  44 #define pgprot_val(x)   (x)
  45 
  46 #define __pte(x)        (x)
  47 #define __pmd(x)        (x)
  48 #define __pgd(x)        (x)
  49 #define __pgprot(x)     (x)
  50 
  51 #endif
  52 
  53 /*
  54  * TLB invalidation:
  55  *
  56  *  - invalidate() invalidates the current task TLBs
  57  *  - invalidate_all() invalidates all processes TLBs
  58  *  - invalidate_task(task) invalidates the specified tasks TLB's
  59  *  - invalidate_page(task, vmaddr) invalidates one page
  60  *
  61  * ..but the i386 has somewhat limited invalidation capabilities.
  62  */
  63  
  64 #ifndef __SMP__
  65 #define invalidate() \
  66 __asm__ __volatile__("movl %%cr3,%%eax\n\tmovl %%eax,%%cr3": : :"ax")
  67 
  68 #define invalidate_all() invalidate()
  69 #define invalidate_task(task) \
  70 do { if ((task)->mm == current->mm) invalidate(); } while (0)
  71 #define invalidate_page(task,addr) \
  72 do { if ((task)->mm == current->mm) invalidate(); } while (0)
  73 
  74 #else
  75 #include <asm/smp.h>
  76 #define local_invalidate() \
  77 __asm__ __volatile__("movl %%cr3,%%eax\n\tmovl %%eax,%%cr3": : :"ax")
  78 #define invalidate() \
  79         smp_invalidate();
  80 #endif
  81 
  82 /* Certain architectures need to do special things when pte's
  83  * within a page table are directly modified.  Thus, the following
  84  * hook is made available.
  85  */
  86 #define set_pte(pteptr, pteval) ((*(pteptr)) = (pteval))
  87 
  88 /* to align the pointer to the (next) page boundary */
  89 #define PAGE_ALIGN(addr)        (((addr)+PAGE_SIZE-1)&PAGE_MASK)
  90 
  91 /* This handles the memory map.. */
  92 #define PAGE_OFFSET             0
  93 #define MAP_NR(addr)            (((unsigned long)(addr)) >> PAGE_SHIFT)
  94 
  95 typedef struct {
  96         unsigned count:24,
  97                  age:6,
  98                  dirty:1,
  99                  reserved:1;
 100 } mem_map_t;
 101 
 102 #endif /* __KERNEL__ */
 103 
 104 #endif /* _I386_PAGE_H */

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