EPT in kvm

1. Overview of EPT

CPU will use both guest page table and extended page table. The address of EPT is set by the function vmx_set_cr3.

1753 static void vmx_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3)
1754 {
1755         unsigned long guest_cr3;
1756         u64 eptp;
1757 
1758         guest_cr3 = cr3;
1759         if (enable_ept) {
1760                 eptp = construct_eptp(cr3);
1761                 vmcs_write64(EPT_POINTER, eptp);
1762                 guest_cr3 = is_paging(vcpu) ? vcpu->arch.cr3 :
1763                         VMX_EPT_IDENTITY_PAGETABLE_ADDR;
1764         }
1765 
1766         vmx_flush_tlb(vcpu);
1767         vmcs_writel(GUEST_CR3, guest_cr3);
1768         if (vcpu->arch.cr0 & X86_CR0_PE)
1769                 vmx_fpu_deactivate(vcpu);
1770 }
EPT (optionally) activated on VM entry
– When EPT active, EPT base pointer (loaded on VM entry from VMCS) points to extended page tables
– EPT deactivated on VM exit

3947 static struct kvm_x86_ops vmx_x86_ops = {

3975         .set_cr3 = vmx_set_cr3,

          .....

}

在函数 kvm_vcpu_ioctl 中

static long kvm_vcpu_ioctl(struct file *filp,  unsigned int ioctl, unsigned long arg)
case KVM_RUN:
           r = -EINVAL;
           if (arg)
                     goto out;
           r = kvm_ar

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值