现摘抄一节:
from:http://blog.163.com/jiangh_1982/blog/static/121950520105176134256/
· CP15的寄存器C10
CP15的C10寄存器用于控制TLB内容锁定。
访问CP15的C10寄存器的指令格式如下所示:
mcr p15, 0, <rd>, <c10>, c0, <opcode_2>
mrc p15, 0, <rd>, <c10>, c0, <opcode_2>
如果系统中包含独立的指令TLB和数据TLB,那么对应于数据TLB和指令TLB分别有一个独立的TLB内容锁定寄存器,<opcode_2>用来选择其中的某个寄存器:
<opcode_2>=1选择指令TLB的内容锁定寄存器;
<opcode_2>=0选择数据TLB的内容锁定寄存器。
C10寄存器的编码格式如下:
31 30 32-W 31-W 32-2W 31-2W 1 0 | |||
可被替换的条目起始地址的base | 下一个将被替换的条目地址victim | 0 | P |
位 | 说 明 |
victim | 指定下一次TLB没有命中(所需的地址变换条目没有包含在TLB中)时,从内存页表中读取所需的地址变换条目,并把该地址变换条目保存在TLB中地址victim处 |
base | 指定TLB替换时,所使用的地址范围,从(base)到(TLB中条目数-1);字段victim的值应该包含在该范围内 |
P | 1:写入TLB的地址变换条目不会受使整个TLB无效操作的影响,一直保持有效;0:写入TLB的地址变换条目将会受到使整个TLB无效操作的影响 |
参考《AARM》,有如下:
If W is the logarithm base 2 of the number of TLB entries, rounded up to an integer if necessary, then the format of CP15 register 10 is:
31 32-W 31-W 32-2W 31-2W 1 0
|base | victim |UNP/SBZP | P|
翻译下来就是w=log2(下标)TLB ENTRIES(上标),即w为以2为下标,TLB数目为上标的对数。
进一步理解参考:http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0151c/I47492.html
摘:
Figure 2.8. Register 10
The entries in the TLBs are replaced using a round-robin replacement policy. This is implemented using a victim counter that counts from entry 0 up to 63, and then wraps back round to the base value and continues counting, wrapping around to the base value from 63 each time.
即有64个TLB的话,VICTIM由0-63循环取值,而且是基于base的,由于victim共六位而且恰好64=2^6,那么就可以理解上面陈述的关于W值的理解了,在这里,W=6,即W是TLB中可存储容量的位数。