From b55b808bfcb652135a2fc0163e4287e3c1299e72 Mon Sep 17 00:00:00 2001 From: Binbin Wu Date: Fri, 1 Jun 2018 14:47:49 +0800 Subject: [PATCH] hv: copy cr0/4 value when init secure world Copy CR0 / CR4 value from normal world context to secure world context when init secure world. Signed-off-by: Binbin Wu Acked-by: Wang Kai Acked-by: Eddie Dong --- hypervisor/arch/x86/trusty.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hypervisor/arch/x86/trusty.c b/hypervisor/arch/x86/trusty.c index 88e67e3c7..ff38b5aeb 100644 --- a/hypervisor/arch/x86/trusty.c +++ b/hypervisor/arch/x86/trusty.c @@ -351,6 +351,11 @@ static bool init_secure_world_env(struct vcpu *vcpu, TRUSTY_EPT_REBASE_GPA + size; vcpu->arch_vcpu.contexts[SECURE_WORLD].tsc_offset = 0; + vcpu->arch_vcpu.contexts[SECURE_WORLD].cr0 = + vcpu->arch_vcpu.contexts[NORMAL_WORLD].cr0; + vcpu->arch_vcpu.contexts[SECURE_WORLD].cr4 = + vcpu->arch_vcpu.contexts[NORMAL_WORLD].cr4; + exec_vmwrite(VMX_GUEST_RSP, TRUSTY_EPT_REBASE_GPA + size); exec_vmwrite(VMX_TSC_OFFSET_FULL,