vbox4/5: fix tr TSS_BUSY_FLAG handling

Fixes #2337
This commit is contained in:
Alexander Boettcher 2017-03-10 11:04:05 +01:00 committed by Christian Helmuth
parent f6c494497b
commit a5c70244bf
7 changed files with 37 additions and 6 deletions

View File

@ -1 +1 @@
b925f6284e93e4865b1ee6a4b1e8c63e4e9611e0
8b8762f34e586d96ec89085422452342c6908f80

View File

@ -1 +1 @@
cc217111ff4444b66fb90dd688c09cefce6e4110
720a329b2f1eb7b71e8b3c7542b9f744224d370a

View File

@ -0,0 +1,34 @@
--- a/src/app/virtualbox/src/recompiler/VBoxRecompiler.c
--- b/src/app/virtualbox/src/recompiler/VBoxRecompiler.c
@@ -2664,13 +2664,14 @@
#endif
}
+ bool busy_set = ((pCtx->tr.Attr.u & SEL_FLAGS_SMASK) << SEL_FLAGS_SHIFT) & DESC_TSS_BUSY_MASK;
if ( pCtx->tr.Sel != pVM->rem.s.Env.tr.selector
|| pCtx->tr.ValidSel != pVM->rem.s.Env.tr.selector
|| pCtx->tr.u64Base != pVM->rem.s.Env.tr.base
|| pCtx->tr.u32Limit != pVM->rem.s.Env.tr.limit
/* Qemu and AMD/Intel have different ideas about the busy flag ... */ /** @todo just fix qemu! */
|| pCtx->tr.Attr.u != ( (pVM->rem.s.Env.tr.flags >> SEL_FLAGS_SHIFT) & (SEL_FLAGS_SMASK & ~DESC_INTEL_UNUSABLE)
- ? (pVM->rem.s.Env.tr.flags | DESC_TSS_BUSY_MASK) >> SEL_FLAGS_SHIFT
+ ? (pVM->rem.s.Env.tr.flags | (busy_set ? DESC_TSS_BUSY_MASK : 0)) >> SEL_FLAGS_SHIFT
: 0)
|| !(pCtx->tr.fFlags & CPUMSELREG_FLAGS_VALID)
)
@@ -2905,13 +2906,14 @@
#endif
}
+ bool busy_set = ((pCtx->tr.Attr.u & SEL_FLAGS_SMASK) << SEL_FLAGS_SHIFT) & DESC_TSS_BUSY_MASK;
if ( pCtx->tr.Sel != pVM->rem.s.Env.tr.selector
|| pCtx->tr.ValidSel != pVM->rem.s.Env.tr.selector
|| pCtx->tr.u64Base != pVM->rem.s.Env.tr.base
|| pCtx->tr.u32Limit != pVM->rem.s.Env.tr.limit
/* Qemu and AMD/Intel have different ideas about the busy flag ... */
|| pCtx->tr.Attr.u != ( (pVM->rem.s.Env.tr.flags >> SEL_FLAGS_SHIFT) & (SEL_FLAGS_SMASK & ~DESC_INTEL_UNUSABLE)
- ? (pVM->rem.s.Env.tr.flags | DESC_TSS_BUSY_MASK) >> SEL_FLAGS_SHIFT
+ ? (pVM->rem.s.Env.tr.flags | (busy_set ? DESC_TSS_BUSY_MASK : 0)) >> SEL_FLAGS_SHIFT
: 0)
|| !(pCtx->tr.fFlags & CPUMSELREG_FLAGS_VALID)
)

View File

@ -15,3 +15,4 @@ tm_retries.patch
vmdk.patch
tm_tpr.patch
tm_4s.patch
rem_tss.patch

View File

@ -320,7 +320,6 @@ inline void check_vm_state(PVMCPU pVCpu, struct Subject_state *cur_state)
Assert(cur_state->ldtr.base == pCtx->ldtr.u64Base);
if(cur_state->ldtr.sel != 0)
Assert(cur_state->ldtr.access == pCtx->ldtr.Attr.u);
Assert(pCtx->tr.Attr.u & X86_SEL_TYPE_SYS_TSS_BUSY_MASK);
{
Assert(cur_state->tr.sel == pCtx->tr.Sel);
Assert(cur_state->tr.limit == pCtx->tr.u32Limit);
@ -455,7 +454,6 @@ int SUPR3CallVMMR0Fast(PVMR0 pVMR0, unsigned uOperation, VMCPUID idCpu)
cur_state->ldtr.base = pCtx->ldtr.u64Base;
cur_state->ldtr.access = pCtx->ldtr.Attr.u;
}
Assert(pCtx->tr.Attr.u & X86_SEL_TYPE_SYS_TSS_BUSY_MASK);
{
cur_state->tr.sel = pCtx->tr.Sel;
cur_state->tr.limit = pCtx->tr.u32Limit;

View File

@ -111,7 +111,6 @@ static inline bool vmx_load_state(Nova::Utcb * utcb, VM * pVM, PVMCPU pVCpu)
}
/* tr */
Assert(pCtx->tr.Attr.u & X86_SEL_TYPE_SYS_TSS_BUSY_MASK);
{
utcb->mtd |= Nova::Mtd::TR;

View File

@ -111,7 +111,6 @@ static inline bool vmx_load_state(Nova::Utcb * utcb, VM * pVM, PVMCPU pVCpu)
}
/* tr */
Assert(pCtx->tr.Attr.u & X86_SEL_TYPE_SYS_TSS_BUSY_MASK);
{
utcb->mtd |= Nova::Mtd::TR;