page.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #ifndef _H8300_PAGE_H
  2. #define _H8300_PAGE_H
  3. /* PAGE_SHIFT determines the page size */
  4. #define PAGE_SHIFT (12)
  5. #define PAGE_SIZE (1UL << PAGE_SHIFT)
  6. #define PAGE_MASK (~(PAGE_SIZE-1))
  7. #include <asm/setup.h>
  8. #ifndef __ASSEMBLY__
  9. #define get_user_page(vaddr) __get_free_page(GFP_KERNEL)
  10. #define free_user_page(page, addr) free_page(addr)
  11. #define clear_page(page) memset((page), 0, PAGE_SIZE)
  12. #define copy_page(to,from) memcpy((to), (from), PAGE_SIZE)
  13. #define clear_user_page(page, vaddr, pg) clear_page(page)
  14. #define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
  15. #define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
  16. alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr)
  17. #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
  18. /*
  19. * These are used to make use of C type-checking..
  20. */
  21. typedef struct { unsigned long pte; } pte_t;
  22. typedef struct { unsigned long pmd[16]; } pmd_t;
  23. typedef struct { unsigned long pgd; } pgd_t;
  24. typedef struct { unsigned long pgprot; } pgprot_t;
  25. typedef struct page *pgtable_t;
  26. #define pte_val(x) ((x).pte)
  27. #define pmd_val(x) ((&x)->pmd[0])
  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. extern unsigned long memory_start;
  35. extern unsigned long memory_end;
  36. #endif /* !__ASSEMBLY__ */
  37. #include <asm/page_offset.h>
  38. #define PAGE_OFFSET (PAGE_OFFSET_RAW)
  39. #ifndef __ASSEMBLY__
  40. #define __pa(vaddr) virt_to_phys(vaddr)
  41. #define __va(paddr) phys_to_virt((unsigned long)paddr)
  42. #define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT)
  43. #define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT)
  44. #define MAP_NR(addr) (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT)
  45. #define virt_to_page(addr) (mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT))
  46. #define page_to_virt(page) ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
  47. #define pfn_valid(page) (page < max_mapnr)
  48. #define ARCH_PFN_OFFSET (PAGE_OFFSET >> PAGE_SHIFT)
  49. #define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
  50. ((void *)(kaddr) < (void *)memory_end))
  51. #endif /* __ASSEMBLY__ */
  52. #include <asm-generic/memory_model.h>
  53. #include <asm-generic/getorder.h>
  54. #endif /* _H8300_PAGE_H */