page.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #ifndef _ALPHA_PAGE_H
  2. #define _ALPHA_PAGE_H
  3. #include <linux/const.h>
  4. #include <asm/pal.h>
  5. /* PAGE_SHIFT determines the page size */
  6. #define PAGE_SHIFT 13
  7. #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
  8. #define PAGE_MASK (~(PAGE_SIZE-1))
  9. #ifndef __ASSEMBLY__
  10. #define STRICT_MM_TYPECHECKS
  11. extern void clear_page(void *page);
  12. #define clear_user_page(page, vaddr, pg) clear_page(page)
  13. #define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
  14. alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vmaddr)
  15. #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
  16. extern void copy_page(void * _to, void * _from);
  17. #define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
  18. #ifdef STRICT_MM_TYPECHECKS
  19. /*
  20. * These are used to make use of C type-checking..
  21. */
  22. typedef struct { unsigned long pte; } pte_t;
  23. typedef struct { unsigned long pmd; } pmd_t;
  24. typedef struct { unsigned long pgd; } pgd_t;
  25. typedef struct { unsigned long pgprot; } pgprot_t;
  26. #define pte_val(x) ((x).pte)
  27. #define pmd_val(x) ((x).pmd)
  28. #define pgd_val(x) ((x).pgd)
  29. #define pgprot_val(x) ((x).pgprot)
  30. #define __pte(x) ((pte_t) { (x) } )
  31. #define __pmd(x) ((pmd_t) { (x) } )
  32. #define __pgd(x) ((pgd_t) { (x) } )
  33. #define __pgprot(x) ((pgprot_t) { (x) } )
  34. #else
  35. /*
  36. * .. while these make it easier on the compiler
  37. */
  38. typedef unsigned long pte_t;
  39. typedef unsigned long pmd_t;
  40. typedef unsigned long pgd_t;
  41. typedef unsigned long pgprot_t;
  42. #define pte_val(x) (x)
  43. #define pmd_val(x) (x)
  44. #define pgd_val(x) (x)
  45. #define pgprot_val(x) (x)
  46. #define __pte(x) (x)
  47. #define __pgd(x) (x)
  48. #define __pgprot(x) (x)
  49. #endif /* STRICT_MM_TYPECHECKS */
  50. typedef struct page *pgtable_t;
  51. #ifdef USE_48_BIT_KSEG
  52. #define PAGE_OFFSET 0xffff800000000000UL
  53. #else
  54. #define PAGE_OFFSET 0xfffffc0000000000UL
  55. #endif
  56. #else
  57. #ifdef USE_48_BIT_KSEG
  58. #define PAGE_OFFSET 0xffff800000000000
  59. #else
  60. #define PAGE_OFFSET 0xfffffc0000000000
  61. #endif
  62. #endif /* !__ASSEMBLY__ */
  63. #define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
  64. #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
  65. #ifndef CONFIG_DISCONTIGMEM
  66. #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
  67. #define pfn_valid(pfn) ((pfn) < max_mapnr)
  68. #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
  69. #endif /* CONFIG_DISCONTIGMEM */
  70. #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
  71. VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
  72. #include <asm-generic/memory_model.h>
  73. #include <asm-generic/getorder.h>
  74. #endif /* _ALPHA_PAGE_H */