FreeBSD 4.0 Kernel Hacking Guide--i386/i386/locore.s( 二 )


..........
920-923行, 将第一个 page table map 到 page directory 的第一个
entry. 这一个 page table 将会"暂时"在 page directory
map 两次. 主要是因为目前的指令实际执行的 address
为 physical address, 当一开始 enable paging 时, 将会
产生一个模糊地带, 使的我们 address 依然是以 physcial
address 的值进行 map, 而不是我们所希望的 KERNBASE
为其 base. 因此, 我们做此 map, 以便在 enable paging
之後, 可以顺利的执行正确的 code.
926-929行, 将 _KPTphys 安装在 page table directory(PDE) 正确的位置,
使 kernel map 到 KERNBASE.
932-935行, 将 PDE 安装在 PDE 上, 这是一个 recursive 的做法, 如
此会使的 PDE 在第二层 mapping 时, 转而成为 page table,
使的原本 PDE 所 mapping 的 page table 反而成为最後的
destination memory. 我们可以直接透过 mapping 直接读每
一个 page table.

推荐阅读