return second_ctrl;
}
-static int vmx_inst_check_privilege(struct cpu_user_regs *regs, int vmxop_check)
-{
- struct vcpu *v = current;
-
- if ( vmxop_check )
- {
- if ( !(v->arch.hvm.guest_cr[0] & X86_CR0_PE) ||
- !(v->arch.hvm.guest_cr[4] & X86_CR4_VMXE) )
- goto invalid_op;
- }
- else if ( !nvmx_vcpu_in_vmx(v) )
- goto invalid_op;
-
- if ( vmx_guest_x86_mode(v) < (hvm_long_mode_active(v) ? 8 : 2) )
- goto invalid_op;
- else if ( nestedhvm_vcpu_in_guestmode(v) )
- goto vmexit;
-
- if ( vmx_get_cpl() > 0 )
- goto gp_fault;
-
- return X86EMUL_OKAY;
-
-vmexit:
- gdprintk(XENLOG_ERR, "vmx_inst_check_privilege: vmexit\n");
- vcpu_nestedhvm(v).nv_vmexit_pending = 1;
- return X86EMUL_EXCEPTION;
-
-invalid_op:
- gdprintk(XENLOG_ERR, "vmx_inst_check_privilege: invalid_op\n");
- hvm_inject_hw_exception(TRAP_invalid_op, X86_EVENT_NO_EC);
- return X86EMUL_EXCEPTION;
-
-gp_fault:
- gdprintk(XENLOG_ERR, "vmx_inst_check_privilege: gp_fault\n");
- hvm_inject_hw_exception(TRAP_gp_fault, 0);
- return X86EMUL_EXCEPTION;
-}
-
static int decode_vmx_inst(struct cpu_user_regs *regs,
struct vmx_inst_decoded *decode,
- unsigned long *poperandS, int vmxon_check)
+ unsigned long *poperandS)
{
struct vcpu *v = current;
union vmx_inst_info info;
unsigned long base, index, seg_base, disp, offset;
int scale, size;
- if ( vmx_inst_check_privilege(regs, vmxon_check) != X86EMUL_OKAY )
- return X86EMUL_EXCEPTION;
-
__vmread(VMX_INSTRUCTION_INFO, &offset);
info.word = offset;
uint32_t nvmcs_revid;
int rc;
- rc = decode_vmx_inst(regs, &decode, &gpa, 1);
+ rc = decode_vmx_inst(regs, &decode, &gpa);
if ( rc != X86EMUL_OKAY )
return rc;
{
struct vcpu *v=current;
struct nestedvmx *nvmx = &vcpu_2_nvmx(v);
- int rc;
-
- rc = vmx_inst_check_privilege(regs, 0);
- if ( rc != X86EMUL_OKAY )
- return rc;
nvmx_purge_vvmcs(v);
nvmx->vmxon_region_pa = INVALID_PADDR;
struct vcpu *v = current;
struct nestedvmx *nvmx = &vcpu_2_nvmx(v);
unsigned long intr_shadow;
- int rc = vmx_inst_check_privilege(regs, 0);
-
- if ( rc != X86EMUL_OKAY )
- return rc;
if ( vcpu_nestedhvm(v).nv_vvmcxaddr == INVALID_PADDR )
{
struct vcpu *v = current;
struct nestedvmx *nvmx = &vcpu_2_nvmx(v);
unsigned long intr_shadow;
- int rc = vmx_inst_check_privilege(regs, 0);
-
- if ( rc != X86EMUL_OKAY )
- return rc;
+ int rc;
if ( vcpu_nestedhvm(v).nv_vvmcxaddr == INVALID_PADDR )
{
unsigned long gpa = 0;
int rc;
- rc = decode_vmx_inst(regs, &decode, &gpa, 0);
+ rc = decode_vmx_inst(regs, &decode, &gpa);
if ( rc != X86EMUL_OKAY )
return rc;
unsigned long gpa = 0;
int rc;
- rc = decode_vmx_inst(regs, &decode, &gpa, 0);
+ rc = decode_vmx_inst(regs, &decode, &gpa);
if ( rc != X86EMUL_OKAY )
return rc;
void *vvmcs;
int rc;
- rc = decode_vmx_inst(regs, &decode, &gpa, 0);
+ rc = decode_vmx_inst(regs, &decode, &gpa);
if ( rc != X86EMUL_OKAY )
return rc;
u64 value = 0;
int rc;
- rc = decode_vmx_inst(regs, &decode, NULL, 0);
+ rc = decode_vmx_inst(regs, &decode, NULL);
if ( rc != X86EMUL_OKAY )
return rc;
bool_t okay = 1;
enum vmx_insn_errno err;
- if ( decode_vmx_inst(regs, &decode, &operand, 0)
- != X86EMUL_OKAY )
+ if ( decode_vmx_inst(regs, &decode, &operand) != X86EMUL_OKAY )
return X86EMUL_EXCEPTION;
if ( vcpu_nestedhvm(v).nv_vvmcxaddr == INVALID_PADDR )
unsigned long eptp;
int ret;
- if ( (ret = decode_vmx_inst(regs, &decode, &eptp, 0)) != X86EMUL_OKAY )
+ if ( (ret = decode_vmx_inst(regs, &decode, &eptp)) != X86EMUL_OKAY )
return ret;
switch ( reg_read(regs, decode.reg2) )
unsigned long vpid;
int ret;
- if ( (ret = decode_vmx_inst(regs, &decode, &vpid, 0)) != X86EMUL_OKAY )
+ if ( (ret = decode_vmx_inst(regs, &decode, &vpid)) != X86EMUL_OKAY )
return ret;
switch ( reg_read(regs, decode.reg2) )