1

语境:

我目前想刷新我的 L1 数据缓存(目标:NXP P2020 Qoriq e500)。

我在使用“dcbf”指令时遇到问题:

dcbf r3, r4 // with r3 and r4 defining the address of the DATA cache

问题:
我的问题是我不知道该指令提供什么参数才能到达 DATA 缓存并刷新行?

我尝试使用“刚刚创建”的变量:

int i = 0; 
// let assume r3 = &i
dcbf 0, r3
isync
msync

我认为 dcbf 指令将通过 &i 参数到达数据缓存,但是当我通过探针进一步查看内存时,我发现缓存未刷新且未失效。

4

2 回答 2

0

我的根本问题是给 dcbf 的地址不在缓存中。
参考手册说:Perform reads to any 48 Kbyte region, THEN execute dcbf instruction

我现在正在搜索如何读取 L1 数据缓存

于 2018-03-27T07:54:18.023 回答
0

好,

我终于这样做来替换我的 L1 数据缓存条目:

FlushL1DCache:
flushloop:
    lwz     r5, 0(r3)       /* Load data to L1 data cache to replace current entries */
    addi    r3, r3, 0x20    /* adds 32 bytes to r3 */
    cmpw    r3, r4          /* if r3 == r4  -> exit the loop */
    ble     flushloop
    msync
    isync
    blr

此代码在失效之前将 L1 数据缓存条目替换为虚拟条目。

于 2018-04-03T08:56:41.770 回答