~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/include/asm-i386/page.h

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  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 #ifndef __ASSEMBLY__
 11 
 12 #include <linux/config.h>
 13 
 14 #ifdef CONFIG_X86_USE_3DNOW
 15 
 16 #include <asm/mmx.h>
 17 
 18 #define clear_page(page)        mmx_clear_page(page)
 19 #define copy_page(to,from)      mmx_copy_page(to,from)
 20 
 21 #else
 22 
 23 /*
 24  *      On older X86 processors its not a win to use MMX here it seems.
 25  *      Maybe the K6-III ?
 26  */
 27  
 28 #define clear_page(page)        memset((void *)(page), 0, PAGE_SIZE)
 29 #define copy_page(to,from)      memcpy((void *)(to), (void *)(from), PAGE_SIZE)
 30 
 31 #endif
 32 
 33 #define clear_user_page(page, vaddr)    clear_page(page)
 34 #define copy_user_page(to, from, vaddr) copy_page(to, from)
 35 
 36 /*
 37  * These are used to make use of C type-checking..
 38  */
 39 #if CONFIG_X86_PAE
 40 typedef struct { unsigned long pte_low, pte_high; } pte_t;
 41 typedef struct { unsigned long long pmd; } pmd_t;
 42 typedef struct { unsigned long long pgd; } pgd_t;
 43 #define pte_val(x)      ((x).pte_low | ((unsigned long long)(x).pte_high << 32))
 44 #else
 45 typedef struct { unsigned long pte_low; } pte_t;
 46 typedef struct { unsigned long pmd; } pmd_t;
 47 typedef struct { unsigned long pgd; } pgd_t;
 48 #define pte_val(x)      ((x).pte_low)
 49 #endif
 50 #define PTE_MASK        PAGE_MASK
 51 
 52 typedef struct { unsigned long pgprot; } pgprot_t;
 53 
 54 #define pmd_val(x)      ((x).pmd)
 55 #define pgd_val(x)      ((x).pgd)
 56 #define pgprot_val(x)   ((x).pgprot)
 57 
 58 #define __pte(x) ((pte_t) { (x) } )
 59 #define __pmd(x) ((pmd_t) { (x) } )
 60 #define __pgd(x) ((pgd_t) { (x) } )
 61 #define __pgprot(x)     ((pgprot_t) { (x) } )
 62 
 63 #endif /* !__ASSEMBLY__ */
 64 
 65 /* to align the pointer to the (next) page boundary */
 66 #define PAGE_ALIGN(addr)        (((addr)+PAGE_SIZE-1)&PAGE_MASK)
 67 
 68 /*
 69  * This handles the memory map.. We could make this a config
 70  * option, but too many people screw it up, and too few need
 71  * it.
 72  *
 73  * A __PAGE_OFFSET of 0xC0000000 means that the kernel has
 74  * a virtual address space of one gigabyte, which limits the
 75  * amount of physical memory you can use to about 950MB. 
 76  *
 77  * If you want more physical memory than this then see the CONFIG_HIGHMEM4G
 78  * and CONFIG_HIGHMEM64G options in the kernel configuration.
 79  */
 80 
 81 #define __PAGE_OFFSET           (0xC0000000)
 82 
 83 #ifndef __ASSEMBLY__
 84 
 85 /*
 86  * Tell the user there is some problem. Beep too, so we can
 87  * see^H^H^Hhear bugs in early bootup as well!
 88  */
 89 #define BUG() do { \
 90         printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
 91         __asm__ __volatile__(".byte 0x0f,0x0b"); \
 92 } while (0)
 93 
 94 #define PAGE_BUG(page) do { \
 95         BUG(); \
 96 } while (0)
 97 
 98 /* Pure 2^n version of get_order */
 99 extern __inline__ int get_order(unsigned long size)
100 {
101         int order;
102 
103         size = (size-1) >> (PAGE_SHIFT-1);
104         order = -1;
105         do {
106                 size >>= 1;
107                 order++;
108         } while (size);
109         return order;
110 }
111 
112 #endif /* __ASSEMBLY__ */
113 
114 #define PAGE_OFFSET             ((unsigned long)__PAGE_OFFSET)
115 #define __pa(x)                 ((unsigned long)(x)-PAGE_OFFSET)
116 #define __va(x)                 ((void *)((unsigned long)(x)+PAGE_OFFSET))
117 #define virt_to_page(kaddr)     (mem_map + (__pa(kaddr) >> PAGE_SHIFT))
118 #define VALID_PAGE(page)        ((page - mem_map) < max_mapnr)
119 
120 
121 #endif /* __KERNEL__ */
122 
123 #endif /* _I386_PAGE_H */
124 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.