page.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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