当前位置:   article > 正文

内存屏障sy/ld/st的详细解释_dmb ld st

dmb ld st
  1. 在arch/arm64/include/asm/barrier.h 中定义了一些内存屏障
  2. #define mb() dsb(sy)
  3. #define rmb() dsb(ld)
  4. #define wmb() dsb(st)
  5. #define dma_mb() dmb(osh)
  6. #define dma_rmb() dmb(oshld)
  7. #define dma_wmb() dmb(oshst)
  8. 这里面的sy/ld/st的详细解释如下:
  9. https://www.keil.com/support/man/docs/armasm/armasm_dom1361289870725.htm
  10. 10.34 DSB
  11. Data Synchronization Barrier.
  12. Syntax
  13. DSB{cond} {option}
  14. where:
  15. cond
  16. is an optional condition code.
  17. Note
  18. cond is permitted only in Thumb code. This is an unconditional instruction in ARM.
  19. option
  20. is an optional limitation on the operation of the hint. Permitted values are:
  21. SY
  22. Full system DSB operation. This is the default and can be omitted.
  23. ST
  24. DSB operation that waits only for stores to complete.
  25. ISH
  26. DSB operation only to the inner shareable domain.
  27. ISHST
  28. DSB operation that waits only for stores to complete, and only to the inner shareable domain.
  29. NSH
  30. DSB operation only out to the point of unification.
  31. NSHST
  32. DSB operation that waits only for stores to complete and only out to the point of unification.
  33. OSH
  34. DSB operation only to the outer shareable domain.
  35. OSHST
  36. DSB operation that waits only for stores to complete, and only to the outer shareable domain.
  37. Operation
  38. Data Synchronization Barrier acts as a special kind of memory barrier. No instruction in program order after this instruction executes until this instruction completes. This instruction completes when:
  39. All explicit memory accesses before this instruction complete.
  40. All Cache, Branch predictor and TLB maintenance operations before this instruction complete.
  41. Alias
  42. The following alternative values of option are supported for DSB, but ARM recommends that you do not use them:
  43. SH is an alias for ISH.
  44. SHST is an alias for ISHST.
  45. UN is an alias for NSH.
  46. UNST is an alias for NSHST.
  47. 如果要在非kernel的代码中用内存屏障,可以参考
  48. arm
  49. asm volatile("dsb\tisb"::: "memory")
  50. x86
  51. asm volatile("mfence"::: "memory")

 

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号