trusty: init & switch world fix

- when init, cr0 & cr4 should read from VMCS
- when world switch, cr0/cr4 read shadow should also be save/restore

v2:
- use context->vmx_cr0/cr4 to save/restore VMX_GUEST_CR0/CR4
- use context->cr0/cr4 to save/restore VMX_CR0/CR4_READ_SHADOW

Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Jason Chen CJ
2018-06-16 14:46:51 +08:00
committed by lijinxia
parent 75c1573aff
commit e84d4dee19
3 changed files with 27 additions and 6 deletions

View File

@@ -7,6 +7,9 @@
#include <hypervisor.h>
#include <hypercall.h>
/* this hcall is only come from trusty enabled vcpu itself, and cannot be
* called from other vcpus
*/
int64_t hcall_world_switch(struct vcpu *vcpu)
{
int next_world_id = !(vcpu->arch_vcpu.cur_context);
@@ -31,6 +34,9 @@ int64_t hcall_world_switch(struct vcpu *vcpu)
return 0;
}
/* this hcall is only come from trusty enabled vcpu itself, and cannot be
* called from other vcpus
*/
int64_t hcall_initialize_trusty(struct vcpu *vcpu, uint64_t param)
{
if (!vcpu->vm->sworld_control.sworld_enabled) {