gpt4 book ai didi

ARM 缓存行为 : is "Clean" or "Invalidate" the correct command to flush cache memory?

转载 作者:行者123 更新时间:2023-12-03 16:15:05 42 4
gpt4 key购买 nike

这可能是一个愚蠢的问题,但我对 ARM CMSIS 缓存操作函数的措辞有些困惑。

ARM CMSIS 公开了可以“清除”缓存的函数、可以“使”缓存无效的函数,以及一组同时执行这两种操作的函数。

这些实际上做什么不清楚,还有arm documentation坦率地说,让我感到困惑:

  • You can invalidate the whole data cache (flush data cache) in one operation without writing back dirty data.
  • You can invalidate individual lines without writing back any dirty data (flush data cache single entry).
  • You can perform cleaning on a line-by-line basis. The data is only written back through the write buffer when a dirty line is encountered, and the cleaned line remains in the cache (clean data cache single entry). You can clean cache lines using either their index within the data cache, or their address within memory.
  • You can clean and flush individual lines in one operation, using either their index within the data cache, or their address within memory.


我的理解是,缓存中的“刷新”数据将导致其被写回主内存,而缓存中的“无效”数据将导致处理器在下次尝试访问相关数据时重新读取主内存。

然而,ARM 文档似乎暗示刷新操作实际上是一个失效操作,而我一直在想的是刷新操作实际上是一个“干净”操作。

我想我只是严重误解了文档。有人可以指出我正确的方向吗?

如果相关,我专门为皮质 M7 开发。

最佳答案

从 armv7-m ARM ARM 他们有这个文本。

The definitions of these operations are:

Clean

A cache clean operation ensures that updates made by an observer that controls the cache are made visible to other observers that can access memory at the point to which the operation is performed. Once the Clean has completed, the new memory values are guaranteed to be visible to the point to which the operation is performed, for example to the point of unification. The cleaning of a cache entry from a cache can overwrite memory that has been written by another observer only if the entry contains a location that has been written to by an observer in the shareability domain of that memory location.

Invalidate

A cache invalidate operation ensures that updates made visible by observers that access memory at the point to which the invalidate is defined are made visible to an observer that controls the cache. This might result in the loss of updates to the locations affected by the invalidate operation that have been written by observers that access the cache. If the address of an entry on which the invalidate operates does not have a Normal Cacheable attribute, or if the cache is disabled, then an invalidate operation also ensures that this address is not present in the cache.



我读到它说清理会将缓存中尚未保存到下一级内存的项目并将其写出(像我这样的一些人称之为刷新)。 Invalidate 不关心是否有未写入的值,它准备缓存,就好像没有要保存的值一样,准备接受新的地址和数据。

我就是这样读的...

关于ARM 缓存行为 : is "Clean" or "Invalidate" the correct command to flush cache memory?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44421754/

42 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com