page.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * linux/arch/unicore32/include/asm/page.h
  3. *
  4. * Code specific to PKUnity SoC and UniCore ISA
  5. *
  6. * Copyright (C) 2001-2010 GUAN Xue-tao
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #ifndef __UNICORE_PAGE_H__
  13. #define __UNICORE_PAGE_H__
  14. /* PAGE_SHIFT determines the page size */
  15. #define PAGE_SHIFT 12
  16. #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
  17. #define PAGE_MASK (~(PAGE_SIZE-1))
  18. #ifndef __ASSEMBLY__
  19. struct page;
  20. struct vm_area_struct;
  21. #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
  22. extern void copy_page(void *to, const void *from);
  23. #define clear_user_page(page, vaddr, pg) clear_page(page)
  24. #define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
  25. #undef STRICT_MM_TYPECHECKS
  26. #ifdef STRICT_MM_TYPECHECKS
  27. /*
  28. * These are used to make use of C type-checking..
  29. */
  30. typedef struct { unsigned long pte; } pte_t;
  31. typedef struct { unsigned long pgd; } pgd_t;
  32. typedef struct { unsigned long pgprot; } pgprot_t;
  33. #define pte_val(x) ((x).pte)
  34. #define pgd_val(x) ((x).pgd)
  35. #define pgprot_val(x) ((x).pgprot)
  36. #define __pte(x) ((pte_t) { (x) })
  37. #define __pgd(x) ((pgd_t) { (x) })
  38. #define __pgprot(x) ((pgprot_t) { (x) })
  39. #else
  40. /*
  41. * .. while these make it easier on the compiler
  42. */
  43. typedef unsigned long pte_t;
  44. typedef unsigned long pgd_t;
  45. typedef unsigned long pgprot_t;
  46. #define pte_val(x) (x)
  47. #define pgd_val(x) (x)
  48. #define pgprot_val(x) (x)
  49. #define __pte(x) (x)
  50. #define __pgd(x) (x)
  51. #define __pgprot(x) (x)
  52. #endif /* STRICT_MM_TYPECHECKS */
  53. typedef struct page *pgtable_t;
  54. extern int pfn_valid(unsigned long);
  55. #include <asm/memory.h>
  56. #endif /* !__ASSEMBLY__ */
  57. #define VM_DATA_DEFAULT_FLAGS \
  58. (VM_READ | VM_WRITE | VM_EXEC | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
  59. #include <asm-generic/getorder.h>
  60. #endif