译注:本章基本未做翻译

10.6 TLB Testing TLB测试

The 80386 provides a mechanism for testing the Translation Lookaside Buffer (TLB), the cache used for translating linear addresses to physical addresses. Although failure of the TLB hardware is extremely unlikely, users may wish to include TLB confidence tests among other power-up confidence tests for the 80386.

80386提供一个测试转换旁路缓冲(TLB)的机制,这个缓冲用来将线性地址转换为物理地址。尽管TLB硬件失效是极端行为,用户还是希望能对80386进行包括TLB信任测试的其他加电信任测试。

Note

This TLB testing mechanism is unique to the 80386 and may not be continued in the same way in future processors. Sortware that uses this mechanism may be incompatible with future processors.

When testing the TLB it is recommended that paging be turned off (PG=0 in CR0) to avoid interference with the test data being written to the TLB.

10.6.1 Structure of the TLB

The TLB is a four-way set-associative memory. Figure 10-3 illustrates the structure of the TLB. There are four sets of eight entries each. Each entry consists of a tag and data. Tags are 24-bits wide. They contain the high-order 20 bits of the linear address, the valid bit, and three attribute bits. The data portion of each entry contains the high-order 20 bits of the physical address.

10.6.2 Test Registers

Two test registers, shown in Figure 10-4, are provided for the purpose of testing. TR6 is the test command register, and TR7 is the test data register. These registers are accessed by variants of the MOV instruction. A test register may be either the source operand or destination operand. The MOV instructions are defined in both real-address mode and protected mode. The test registers are privileged resources; in protected mode, the MOV instructions that access them can only be executed at privilege level 0. An attempt to read or write the test registers when executing at any other privilege level causes a general protection exception.

The test command register (TR6) contains a command and an address tag to use in performing the command:

C

This is the command bit. There are two TLB testing commands: write entries into the TLB, and perform TLB lookups. To cause an immediate write into the TLB entry, move a doubleword into TR6 that contains a 0 in this bit. To cause an immediate TLB lookup, move a doubleword into TR6 that contains a 1 in this bit.

Linear Address

On a TLB write, a TLB entry is allocated to this linear address; the rest of that TLB entry is set per the value of TR7 and the value just written into TR6. On a TLB lookup, the TLB is interrogated per this value; if one and only one TLB entry matches, the rest of the fields of TR6 and TR7 are set from the matching TLB entry.

V

The valid bit for this TLB entry. The TLB uses the valid bit to identify entries that contain valid data. Entries of the TLB that have not been assigned values have zero in the valid bit. All valid bits can be cleared by writing to CR3.

D, D#

The dirty bit (and its complement) for/from the TLB entry.

U, U#

The U/S bit (and its complement) for/from the TLB entry.

W, W#

The R/W bit (and its complement) for/from the TLB entry.

The meaning of these pairs of bits is given by Table 10-1, where X represents D, U, or W.

The test data register (TR7) holds data read from or data to be written to the TLB.

Physical Address

This is the data field of the TLB. On a write to the TLB, the TLB entry allocated to the linear address in TR6 is set to this value. On a TLB lookup, if HT is set, the data field (physical address) from the TLB is read out to this field. If HT is not set, this field is undefined.

HT

For a TLB lookup, the HT bit indicates whether the lookup was a hit (HT := 1) or a miss (HT := 0). For a TLB write, HT must be set to 1.

REP

For a TLB write, selects which of four associative blocks of the TLB is to be written. For a TLB read, if HT is set, REP reports in which of the four associative blocks the tag was found; if HT is not set, REP is undefined.

Table 10-1. Meaning of D, U, and W Bit Pairs

X     X#      Effect during        Value of bit X

TLB Lookup           after TLB Write

0     0       (undefined)          (undefined)

0     1       Match if X=0         Bit X becomes 0

1     0       Match if X=1         Bit X becomes 1

1     1       (undefined)          (undefined)

10.6.3 Test Operations

To write a TLB entry:

  1. Move a doubleword to TR7 that contains the desired physical address, HT, and REP values. HT must contain 1. REP must point to the associative block in which to place the entry.
  2. Move a doubleword to TR6 that contains the appropriate linear address, and values for V, D, U, and W. Be sure C=0 for "write" command.

Be careful not to write duplicate tags; the results of doing so are undefined. To look up (read) a TLB entry:

  1. Move a doubleword to TR6 that contains the appropriate linear address and attributes. Be sure C=1 for "lookup" command.
  2. Store TR7. If the HT bit in TR7 indicates a hit, then the other values reveal the TLB contents. If HT indicates a miss, then the other values in TR7 are indeterminate.

For the purposes of testing, the V bit functions as another bit of addresss. The V bit for a lookup request should usually be set, so that uninitialized tags do not match. Lookups with V=0 are unpredictable if any tags are uninitialized.

最新文章

  1. 5.SVM核函数
  2. 读书笔记--SQL必知必会03--排序检索数据
  3. linux中redis安装
  4. explain 执行计划详解
  5. 【FPGA】相关介绍
  6. Immutable 详解
  7. Struts2.3.4+Hibernate4.2.4+Mysql6.0整合
  8. hihocoder 1084 扩展KMP && 2014 北京邀请赛 Justice String
  9. 九九乘法口诀引申出NN乘法口诀
  10. python进阶3--文件系统
  11. HTML link标签media参数
  12. selenium中的webdriver定位元素失败的常见原因
  13. Java表达式中的那些坑
  14. Vue之彻底理解自定义组件的v-model
  15. [LeetCode] Longest Word in Dictionary 字典中的最长单词
  16. day 1——字典树练习
  17. thinkphp 3.2.1 URL 大小写问题 下面有具体说明
  18. docker --Nexus仓库
  19. 帝国cms修改栏目后文章列表的url错误怎么解决
  20. BarTender表单的人性化设计—分组框

热门文章

  1. MVC优缺点
  2. Synthesizing Images of Humans in Unseen Poses
  3. JDK各版本内容和新特性
  4. git 如何让单个文件回退到指定的版本【转】
  5. java web框架收集
  6. Masonry 动画更新约束
  7. apache服务器本质
  8. bzoj1007 [HNOI2008]水平可见直线——单调栈
  9. nginx中查看关于php的配置和php-fpm的重启等操作
  10. ASP.NET Core MVC 打造一个简单的图书馆管理系统 (修正版)(四)图书信息的增删改查