PMMSESSION_WIN7 Session = (PMMSESSION_WIN7)MmSession;
for (ULONG i = 0; i < Session->SystemSpaceHashSize; i ++) {
if (Session->SystemSpaceViewTable[i].Entry != 0) {
PVOID BaseAddress = (PVOID)(((Session->SystemSpaceViewTable[i].Entry >> 16) << 16) | 0xFFFF000000000000ull);//Higher 48 bit of Entry is BaseAddress aligned to 64k
SIZE_T ViewSize = (Session->SystemSpaceViewTable[i].Entry & 0xFFFFull) * 0x10000;//lowest 16 bit of Entry is SizeIn64k
//Now you get BaseAddress and ViewSize, ViewSize is count in bytes.
}
}
}
PMMSESSION_WIN7 Session = (PMMSESSION_WIN7)MmSession;
for (ULONG i = 0; i < Session->SystemSpaceHashSize; i ++) {
if (Session->SystemSpaceViewTable[i].Entry != 0) {
PVOID BaseAddress = (PVOID)(((Session->SystemSpaceViewTable[i].Entry >> 16) << 16) | 0xFFFF000000000000ull);//Higher 48 bit of Entry is BaseAddress aligned to 64k
SIZE_T ViewSize = (Session->SystemSpaceViewTable[i].Entry & 0xFFFFull) * 0x10000;//lowest 16 bit of Entry is SizeIn64k
//Now you get BaseAddress and ViewSize, ViewSize is count in bytes.
}
}
}
写的不错,整理一下:首先讨论不同版本上加入 system VA entry 的算法,再分别给出枚举方式:对于哈希表用迭代;对于树则从根节点递归调用自身到叶节点;MiInsertInSystemSpace() 负责插入 system VA ; MiReserveSystemPtes() 负责构建出描述该 system VA 的 PTE,各司其职;这种访问 RAM 时才实际分配的懒惰算法有助于节约 PFN 数据库的空间。两个关键的全局数据结构:SystemSpaceViewTable 与 ViewRoot 。看来在微软总部雷德蒙德开发os挺有趣的