Expand description
slot-manager
这个 module 中提供两个 struct LeafSlot 和 SlotManager
§LeafSlot
LeafSlot 对 sel4 提供的 slot 进行抽象,可以对 slot 进行管理 和操作,或者从特定的 Slot 中创建一个新的 LeafSlot。
LeafSlot 采用类似页表的设计,每个 CNode 有 4096 个 Slot (size_bits 为 12), 总体采用多级设计,目前准备采用 2 级设计,一共可以容纳 2^24 个 Slot,可以满足大部分的需求。 如果只容纳物理页,那么最大可以使用 2^24 个物理页,也就是 64G 的物理内存
+-----------+-----------+---------+
| 63..24 | 23..12 | 11..0 |
+-----------+-----------+---------+
| Not Used | Level 1 | Level 0 |
+-----------+-----------+---------+
为什么叫 LeafSlot 是因为 LeafSlot 永远指向最后一级页表中的 Slot,Level 1
中指向的 Slot
也叫 NonLeafSlot
,中永远只包含 CNode
。
注意:root-task 启动时默认仅一级,只能容纳 4096 个 slot, 且有一些 slot 已经安排了内容, 如果需要在 root-task 中使用,需要重建 CSpace。这里暂时不提供重建的函数。
§SlotManager
SlotManager 通过指定空 Slot 的范围创建,对空 slot 进行管理,可以申请新的 slot 位置。 申请后范围的结构为 LeafSlot
Structs§
- Leaf
Slot - 叶子 slot
- Slot
Manager - Slot 管理器
- Slot
Range - Slot 范围