有没有办法读取CPU缓存内容?
架构适用于 ARM。
我正在使一系列地址无效,然后想确定它是否无效。
虽然我可以在有和没有无效和检查无效的情况下读取和写入地址范围,但我想知道是否可以读取缓存内容
谢谢!!
最佳答案
ARM9 提供高速缓存操作和测试寄存器,允许您检查高速缓存的状态。这是一个合理的起点:
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0151c/Chdcfejb.html
The ICache and DCache are maintained using MCR and MRC instructions to CP15 registers 7 and 9, defined by the ARM v4T programmer’s model. Additional operations are available using MCR and MRC to CP15 register 15. These operations are combined with those using registers 7 and 9 to enable testing of the caches entirely in software.
这些是特权指令,因此可能无法在您的目标平台上访问。
我将从一个简单的程序开始,该程序转储所有缓存行的状态。这应该为您提供足够的信息,只需读取缓存标签提供的内存位置即可读取缓存中的数据。
关于caching - 读取 CPU 缓存内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1006981/