give priority for VMX induced #UD in INVPCID and RDTSCP instructions over all other exeptions that could be generated there
This commit is contained in:
parent
72b9d26717
commit
27e23ad1eb
@ -668,7 +668,7 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::RDTSCP(bxInstruction_c *i)
|
|||||||
#if BX_SUPPORT_X86_64
|
#if BX_SUPPORT_X86_64
|
||||||
|
|
||||||
#if BX_SUPPORT_VMX
|
#if BX_SUPPORT_VMX
|
||||||
// RDTSCP will always #UD in legacy VMX mode
|
// RDTSCP will always #UD in legacy VMX mode, the #UD takes priority over any other exception the instruction may incur.
|
||||||
if (BX_CPU_THIS_PTR in_vmx_guest) {
|
if (BX_CPU_THIS_PTR in_vmx_guest) {
|
||||||
if (! SECONDARY_VMEXEC_CONTROL(VMX_VM_EXEC_CTRL3_RDTSCP)) {
|
if (! SECONDARY_VMEXEC_CONTROL(VMX_VM_EXEC_CTRL3_RDTSCP)) {
|
||||||
BX_ERROR(("%s in VMX guest: not allowed to use instruction !", i->getIaOpcodeNameShort()));
|
BX_ERROR(("%s in VMX guest: not allowed to use instruction !", i->getIaOpcodeNameShort()));
|
||||||
|
@ -3626,25 +3626,27 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::INVVPID(bxInstruction_c *i)
|
|||||||
|
|
||||||
void BX_CPP_AttrRegparmN(1) BX_CPU_C::INVPCID(bxInstruction_c *i)
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::INVPCID(bxInstruction_c *i)
|
||||||
{
|
{
|
||||||
if (v8086_mode()) {
|
|
||||||
BX_ERROR(("INVPCID: #GP - not recognized in v8086 mode"));
|
|
||||||
exception(BX_GP_EXCEPTION, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if BX_SUPPORT_VMX
|
#if BX_SUPPORT_VMX
|
||||||
// INVPCID will always #UD in legacy VMX mode
|
// INVPCID will always #UD in legacy VMX mode, the #UD takes priority over any other exception the instruction may incur.
|
||||||
if (BX_CPU_THIS_PTR in_vmx_guest) {
|
if (BX_CPU_THIS_PTR in_vmx_guest) {
|
||||||
if (! SECONDARY_VMEXEC_CONTROL(VMX_VM_EXEC_CTRL3_INVPCID)) {
|
if (! SECONDARY_VMEXEC_CONTROL(VMX_VM_EXEC_CTRL3_INVPCID)) {
|
||||||
BX_ERROR(("INVPCID in VMX guest: not allowed to use instruction !"));
|
BX_ERROR(("INVPCID in VMX guest: not allowed to use instruction !"));
|
||||||
exception(BX_UD_EXCEPTION, 0);
|
exception(BX_UD_EXCEPTION, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BX_SUPPORT_VMX >= 2
|
|
||||||
if (VMEXIT(VMX_VM_EXEC_CTRL2_INVLPG_VMEXIT)) {
|
|
||||||
VMexit_Instruction(i, VMX_VMEXIT_INVPCID);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (v8086_mode()) {
|
||||||
|
BX_ERROR(("INVPCID: #GP - not recognized in v8086 mode"));
|
||||||
|
exception(BX_GP_EXCEPTION, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if BX_SUPPORT_VMX >= 2
|
||||||
|
// INVPCID will always #UD in legacy VMX mode
|
||||||
|
if (BX_CPU_THIS_PTR in_vmx_guest) {
|
||||||
|
if (VMEXIT(VMX_VM_EXEC_CTRL2_INVLPG_VMEXIT)) {
|
||||||
|
VMexit_Instruction(i, VMX_VMEXIT_INVPCID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user