在 初始化VMCS 中GuestStae 状态块的时候我初始化了 PDPTEs 的四个 寄存器字段 代码如下
typedef union {
ULONG64 all;
struct {
ULONG64 present : 1; //!< [0]
ULONG64 reserved1 : 2; //!< [1:2]
ULONG64 write_through : 1; //!< [3]
ULONG64 cache_disable : 1; //!< [4]
ULONG64 reserved2 : 4; //!< [5:8]
ULONG64 ignored : 3; //!< [9:11]
ULONG64 page_directory_pa : 41; //!< [12:52]
ULONG64 reserved3 : 11; //!< [53:63]
} fields;
}PdptrRegister;
PVOID pd_addr;
PHYSICAL_ADDRESS PFN;
Asm_SetCr3(Asm_GetCr3());
PdptrRegister pd_pointers[4] = {0};
for (auto i = 0ul; i < 4; ++i)
{
pd_addr = 0xc0600000 + i * PAGE_SIZE; //PDPT目录表的4个表项也就是四个PDT的起始虚拟地址
pd_pointers[i].fields.present = 1;
PFN = MmGetPhysicalAddress(pd_addr);
pd_pointers[i].fields.page_directory_pa = PFN.QuadPart >> 12;
}
Asm_SetCr3(Asm_GetCr3());
Vmx_VmWrite(GUEST_PDPTE0, pd_pointers[0].all&0xffffffff);
Vmx_VmWrite(GUEST_PDPTE0High, pd_pointers[0].all >> 32);
Vmx_VmWrite(GUEST_PDPTE1, pd_pointers[1].all & 0xffffffff);
Vmx_VmWrite(GUEST_PDPTE1High, pd_pointers[1].all >> 32);
Vmx_VmWrite(GUEST_PDPTE2, pd_pointers[2].all & 0xffffffff);
Vmx_VmWrite(GUEST_PDPTE2High, pd_pointers[2].all >> 32);
Vmx_VmWrite(GUEST_PDPTE3, pd_pointers[3].all & 0xffffffff);
Vmx_VmWrite(GUEST_PDPTE3High, pd_pointers[3].all >> 32);
然后初始化了 EPT分页结构 但是 当跑起来的时候 总是出现 三重错误 ~~~~~EPT 我用的 4K分页 代码没有问题 我检查了很多遍 ~~~
但总出现这个 三重错误 让我 无可耐何 不知道该怎么找到错误 源头
求指导 ~~~ 还有 其他哪些 地方 是不是我遗漏 了 什么字段
[CTF入门培训]顶尖高校博士及硕士团队亲授《30小时教你玩转CTF》,视频+靶场+题目!助力进入CTF世界