cache.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:1k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. #ifndef __LINUX_CACHE_H
  2. #define __LINUX_CACHE_H
  3. #include <linux/config.h>
  4. #include <asm/cache.h>
  5. #ifndef L1_CACHE_ALIGN
  6. #define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))
  7. #endif
  8. #ifndef SMP_CACHE_BYTES
  9. #define SMP_CACHE_BYTES L1_CACHE_BYTES
  10. #endif
  11. #ifndef ____cacheline_aligned
  12. #define ____cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES)))
  13. #endif
  14. #ifndef ____cacheline_aligned_in_smp
  15. #ifdef CONFIG_SMP
  16. #define ____cacheline_aligned_in_smp ____cacheline_aligned
  17. #else
  18. #define ____cacheline_aligned_in_smp
  19. #endif /* CONFIG_SMP */
  20. #endif
  21. #ifndef __cacheline_aligned
  22. #ifdef MODULE
  23. #define __cacheline_aligned ____cacheline_aligned
  24. #else
  25. #define __cacheline_aligned
  26.   __attribute__((__aligned__(SMP_CACHE_BYTES),
  27.  __section__(".data.cacheline_aligned")))
  28. #endif
  29. #endif /* __cacheline_aligned */
  30. #ifndef __cacheline_aligned_in_smp
  31. #ifdef CONFIG_SMP
  32. #define __cacheline_aligned_in_smp __cacheline_aligned
  33. #else
  34. #define __cacheline_aligned_in_smp
  35. #endif /* CONFIG_SMP */
  36. #endif
  37. #endif /* __LINUX_CACHE_H */