VMSAv8-64 translation table format descriptors

通常情况下,一个 descriptor 可能是以下的几种 entry:

  • 非法或者异常的 entry。
  • Table entry, 指向 next-level translation table。
  • Block entry, 定义内存访问的 memory properties。
  • Reserved format。

Descriptor 的 bit[1] 用于指示 descriptor 的类型,bit[0] 用于指示 descriptor 是否有效。

D4.3.1 VMSAv8-64 translation table level 0 level 1 and level 2 descriptor formats

在 VMSAv8-64 的 level 0、level 1 和 level 2 的 translation table descriptor 的格式主要存在以下的差异:

  • 是否存在 block entry。
  • block entry 所描述的内存块的大小。

在不同的 translation granule 下,不同 level 的差异如下:

4KB granule
Level 0 descriptor 不支持 block translation。 Block entry:

  • 在 level 1 table 中,映射 1GB 的 input address range
  • 在 level 2 table 中,映射 2MB 的 input address range

16KB granule
Level 0 和 level 1 descriptors 都不支持 block translation 在 Level 2 table 中,block entry 映射 32MB 的 input address range

64KB granule
不支持 Level 0 lookup 操作。 Level 1 descriptor 不支持 block translation 在 Level 2 table 中,block entry 映射 512MB 的 input address range

Figure D4-16 描述了 ARMv8 level 0, level 1, and level 2 descriptor 格式:

Descriptor encodings, ARMv8 level 0, level 1, and level 2 formats

Descriptor 的 bit[0] 指明该 descriptor 是否有效,该 bit 为 1 时,为有效的 descriptor。如果一次 lookup 操作返回一个无效的 descriptor,那么就意味着该 input address 没有进行映射,当访问该 input address 时,会产生 Translation fault。Descriptor 的 bit[1] 指明该 descriptor 的类型,如下表所示:

   
0BlockDescriptor 包含了一个内存块的基地址和属性。
1TableDescriptor 包含了下一级 translation table 的基地址,在 stage 1 translation 中,还包含对应的 translation 的属性信息。

有效的 descriptor 中的其他比特位的含义如下:

Block descriptor
Gives the base address and attributes of a block of memory, as follows:
包含一个 memory block 的基地址和属性信息,如下:

4KB translation granule

  • 在 level 1 Block descriptor 中,bits[47:30] 为 output address 的 bits[47:30]。此 output address 指向一个 1GB 的 memory block。
  • 在 level 2 Block descriptor 中,bits[47:21] 为 output address 的 bits[47:21]。此 output address 指向一个 2MB 的 memory block。

16KB translation granule

  • 在 level 2 Block descriptor 中,bits[47:25] 为 output address 的 bits[47:25]。此 output address 指向一个 32MB 的 memory block。

64KB translation granule

  • 在 level 2 Block descriptor 中,bits[47:29] 为 output address 的 bits[47:29]。此 output address 指向一个 512MB 的 memory block。

Bits[63:52, 11:2] 包含该 memory block 的属性信息。

Level 2 block descriptor 和 level 3 page descriptor 中的 Bits[63:52, 11:2] 含义是相同的。

Table descriptor
包含下一级 translation table 的基地址,如下:

4KB translation granule

  • bits[47:12] 为 output address 的 bits[47:12],同时:基地址的 Bits[11:0] 为 0.
    • 在 level 0 Table descriptor 中, output address 为 level 1 table 的基地址。
    • 在 level 1 Table descriptor 中, output address 为 level 2 table 的基地址
    • 在 level 2 Table descriptor 中, output address 为 level 3 table 的基地址

16KB translation granule

  • bits[47:14] 为 output address 的 bits[47:14],同时:基地址的 Bits[13:0] 为 0.
    • 在 level 0 Table descriptor 中, output address 为 level 1 table 的基地址。
    • 在 level 1 Table descriptor 中, output address 为 level 2 table 的基地址
    • 在 level 2 Table descriptor 中, output address 为 level 3 table 的基地址

64KB translation granule

  • bits[47:16] 为 output address 的 bits[47:16],同时:基地址的 Bits[15:0] 为 0。
    • 在 level 1 Table descriptor 中, output address 为 level 2 table 的基地址
    • 在 level 2 Table descriptor 中, output address 为 level 3 table 的基地址

在 stage 1 translation 中, bits[63:59] 包含 next-level lookup 的属性信息。

如果 translation table 属于 Non-secure EL1&0 stage 1 translation,那么 descriptor 中的 output address 为目标 block 或者 table 的 IPA,如果不属于,那么 output address 为目标 block 或者 table 的 PA。

 

D4.3.2 ARMv8 translation table level 3 descriptor formats

使用 4KB granule 时,level 3 table 中的每一个 entry 都映射了 4KB 的 input address range。
使用 16KB granule 时,level 3 table 中的每一个 entry 都映射了 16KB 的 input address range。
使用 64KB granule 时,level 3 table 中的每一个 entry 都映射了 64KB 的 input address range。
Figure D4-17 描述了 ARMv8 level 3 descriptor 的格式

Descriptor 的 bit[0] 指明该 descriptor 是否有效,该 bit 为 1 时,为有效的 descriptor。如果一次 lookup 操作返回一个无效的descriptor,那么就意味着该 input address 没有进行映射,当访问该 input address 时,会产生 Translation fault。Descriptor 的 bit[1] 指明该 descriptor 的类型,如下所示:

在此 level 中,只存在 Page descriptor。Page descriptor 的其他位的含义如下:在此 level 中,只存在 Page descriptor。Page descriptor 的其他位的含义如下:
Page descriptor
该 descriptor 包含了一个 page 的地址,如下所示:
4KB translation granule
Bits[47:12] 为 page 的地址的 bits[47:12]。
16KB translation granule
Bits[47:14] 为 page 的地址的 bits[47:14]。
64KB translation granule
Bits[47:16] 为 page 的地址的 bits[47:16]。
Bits[63:52, 11:2] 包含 page 的属性信息。

NOTE:
Page descriptor 的 bits[63:52, 11:2] 与 level 0、level 1 和 level 2 中的 block descriptor 中的 bits[63:52, 11:2] 的用途是相同的。
如果 translation table 属于 Non-secure EL1&0 stage 1 translation,那么 descriptor 中的 output address 为 page 的 IPA,如果不属于,那么 output address 为 page 的 PA

 

转载于:https://www.cnblogs.com/ZP1015/p/7719267.html

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值