cacheflush.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #ifndef _SPARC64_CACHEFLUSH_H
  2. #define _SPARC64_CACHEFLUSH_H
  3. #include <asm/page.h>
  4. #ifndef __ASSEMBLY__
  5. #include <linux/mm.h>
  6. /* Cache flush operations. */
  7. /* These are the same regardless of whether this is an SMP kernel or not. */
  8. #define flush_cache_mm(__mm) \
  9. do { if ((__mm) == current->mm) flushw_user(); } while(0)
  10. #define flush_cache_range(vma, start, end) \
  11. flush_cache_mm((vma)->vm_mm)
  12. #define flush_cache_page(vma, page, pfn) \
  13. flush_cache_mm((vma)->vm_mm)
  14. /*
  15. * On spitfire, the icache doesn't snoop local stores and we don't
  16. * use block commit stores (which invalidate icache lines) during
  17. * module load, so we need this.
  18. */
  19. extern void flush_icache_range(unsigned long start, unsigned long end);
  20. extern void __flush_icache_page(unsigned long);
  21. extern void __flush_dcache_page(void *addr, int flush_icache);
  22. extern void flush_dcache_page_impl(struct page *page);
  23. #ifdef CONFIG_SMP
  24. extern void smp_flush_dcache_page_impl(struct page *page, int cpu);
  25. extern void flush_dcache_page_all(struct mm_struct *mm, struct page *page);
  26. #else
  27. #define smp_flush_dcache_page_impl(page,cpu) flush_dcache_page_impl(page)
  28. #define flush_dcache_page_all(mm,page) flush_dcache_page_impl(page)
  29. #endif
  30. extern void __flush_dcache_range(unsigned long start, unsigned long end);
  31. extern void flush_dcache_page(struct page *page);
  32. #define flush_icache_page(vma, pg) do { } while(0)
  33. #define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
  34. extern void flush_ptrace_access(struct vm_area_struct *, struct page *,
  35. unsigned long uaddr, void *kaddr,
  36. unsigned long len, int write);
  37. #define copy_to_user_page(vma, page, vaddr, dst, src, len) \
  38. do { \
  39. flush_cache_page(vma, vaddr, page_to_pfn(page)); \
  40. memcpy(dst, src, len); \
  41. flush_ptrace_access(vma, page, vaddr, src, len, 0); \
  42. } while (0)
  43. #define copy_from_user_page(vma, page, vaddr, dst, src, len) \
  44. do { \
  45. flush_cache_page(vma, vaddr, page_to_pfn(page)); \
  46. memcpy(dst, src, len); \
  47. flush_ptrace_access(vma, page, vaddr, dst, len, 1); \
  48. } while (0)
  49. #define flush_dcache_mmap_lock(mapping) do { } while (0)
  50. #define flush_dcache_mmap_unlock(mapping) do { } while (0)
  51. #define flush_cache_vmap(start, end) do { } while (0)
  52. #define flush_cache_vunmap(start, end) do { } while (0)
  53. #ifdef CONFIG_DEBUG_PAGEALLOC
  54. /* internal debugging function */
  55. void kernel_map_pages(struct page *page, int numpages, int enable);
  56. #endif
  57. #endif /* !__ASSEMBLY__ */
  58. #endif /* _SPARC64_CACHEFLUSH_H */