home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lxapi32.zip / Include / asm / page.h < prev    next >
C/C++ Source or Header  |  2002-04-26  |  2KB  |  79 lines

  1. /* $Id: page.h,v 1.2 2002/04/26 23:09:20 smilcke Exp $ */
  2.  
  3. #ifndef _I386_PAGE_H
  4. #define _I386_PAGE_H
  5.  
  6. /* PAGE_SHIFT determines the page size */
  7. #define PAGE_SHIFT    12
  8. #define PAGE_SIZE    (1UL << PAGE_SHIFT)
  9. #define PAGE_MASK    (~(PAGE_SIZE-1))
  10.  
  11. #ifdef __KERNEL__
  12. #ifndef __ASSEMBLY__
  13.  
  14. //#include <linux/config.h>
  15.  
  16. /*
  17.  *    On older X86 processors its not a win to use MMX here it seems.
  18.  *    Maybe the K6-III ?
  19.  */
  20.  
  21. #define clear_page(page)    memset((void *)(page), 0, PAGE_SIZE)
  22. #define copy_page(to,from)    memcpy((void *)(to), (void *)(from), PAGE_SIZE)
  23.  
  24. /*
  25.  * These are used to make use of C type-checking..
  26.  */
  27. #if CONFIG_X86_PAE
  28. typedef struct { unsigned long long pte; } pte_t;
  29. typedef struct { unsigned long long pmd; } pmd_t;
  30. typedef struct { unsigned long long pgd; } pgd_t;
  31. #else
  32. typedef struct { unsigned long pte; } pte_t;
  33. typedef struct { unsigned long pmd; } pmd_t;
  34. typedef struct { unsigned long pgd; } pgd_t;
  35. #endif
  36.  
  37. #ifdef TARGET_OS2
  38. typedef unsigned long pgprot_t;
  39. #else
  40. typedef struct { unsigned long pgprot; } pgprot_t;
  41. #endif
  42.  
  43. #define pte_val(x)    ((x).pte)
  44. #define pmd_val(x)    ((x).pmd)
  45. #define pgd_val(x)    ((x).pgd)
  46. #define pgprot_val(x)    ((x).pgprot)
  47.  
  48. #define __pgprot(x)    ((pgprot_t) { (x) } )
  49.  
  50. #endif /* !__ASSEMBLY__ */
  51.  
  52. /* to align the pointer to the (next) page boundary */
  53. #define PAGE_ALIGN(addr)    (((addr)+PAGE_SIZE-1)&PAGE_MASK)
  54.  
  55. /*
  56.  * This handles the memory map.. We could make this a config
  57.  * option, but too many people screw it up, and too few need
  58.  * it.
  59.  *
  60.  * A __PAGE_OFFSET of 0xC0000000 means that the kernel has
  61.  * a virtual address space of one gigabyte, which limits the
  62.  * amount of physical memory you can use to about 950MB. 
  63.  *
  64.  * If you want more physical memory than this then see the CONFIG_BIGMEM
  65.  * option in the kernel configuration.
  66.  */
  67.  
  68. #define __PAGE_OFFSET        (0xC0000000)
  69.  
  70. #define PAGE_OFFSET        ((unsigned long)__PAGE_OFFSET)
  71. #define __pa(x)            ((unsigned long)(x)-PAGE_OFFSET)
  72. #define __va(x)            ((void *)((unsigned long)(x)+PAGE_OFFSET))
  73. #define MAP_NR(addr)        (__pa(addr) >> PAGE_SHIFT)
  74. #define PHYSMAP_NR(addr)    ((unsigned long)(addr) >> PAGE_SHIFT)
  75.  
  76. #endif /* __KERNEL__ */
  77.  
  78. #endif /* _I386_PAGE_H */
  79.