vm_load: update init gdt preparation

Now, we use native gdt saved in boot context for guest and assume
it could be put to same address of guest. But it may not be true
after the pre-launched VM is introduced. The gdt for guest could
be overwritten by guest images.

This patch make 32bit protect mode boot not use saved boot context.
Insteadly, we use predefined vcpu_regs value for protect guest to
initialize the guest bsp registers and copy pre-defined gdt table
to a safe place of guest memory to avoid gdt table overwritten by
guest images.

Tracked-On: #3532

Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Yin Fengwei
2019-07-10 11:48:36 +08:00
committed by wenlingz
parent 700a37856f
commit 6beb34c3cb
3 changed files with 64 additions and 13 deletions

View File

@@ -603,6 +603,18 @@ void set_vcpu_regs(struct acrn_vcpu *vcpu, struct acrn_vcpu_regs *vcpu_regs);
*/
void reset_vcpu_regs(struct acrn_vcpu *vcpu);
/**
* @brief Initialize the protect mode vcpu registers
*
* Initialize vCPU's all registers in run_context to initial protece mode values.
*
* @param[inout] vcpu pointer to vcpu data structure
* @param[in] vgdt_base_gpa guest physical address of gdt for guest
*
* @return None
*/
void init_vcpu_protect_mode_regs(struct acrn_vcpu *vcpu, uint64_t vgdt_base_gpa);
/**
* @brief set the vCPU startup entry
*