mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
x86/emul: Hold x86_emulate() to strict X86EMUL_EXCEPTION requirements
All known paths raising faults behind the back of the emulator have been fixed. Reinstate the original intended assertion concerning the behaviour of X86EMUL_EXCEPTION and ctxt->event_pending. As x86_emulate_wrapper() now covers both PV and HVM guests properly, there is no need for the PV assertions following calls to x86_emulate(). Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
1 parent
9c5a84fff5
commit
92cf67888a
3 files changed
+5
-19
No files matched your search
@@ -5420,9 +5420,6 @@ int ptwr_do_page_fault(struct vcpu *v, unsigned long addr,
|
||||
page_unlock(page);
|
||||
put_page(page);
|
||||
|
||||
/* More strict than x86_emulate_wrapper(), as this is now true for PV. */
|
||||
ASSERT(ptwr_ctxt.ctxt.event_pending == (rc == X86EMUL_EXCEPTION));
|
||||
|
||||
switch ( rc )
|
||||
{
|
||||
case X86EMUL_EXCEPTION:
|
||||
@@ -5574,9 +5571,6 @@ int mmio_ro_do_page_fault(struct vcpu *v, unsigned long addr,
|
||||
else
|
||||
rc = x86_emulate(&ctxt, &mmio_ro_emulate_ops);
|
||||
|
||||
/* More strict than x86_emulate_wrapper(), as this is now true for PV. */
|
||||
ASSERT(ctxt.event_pending == (rc == X86EMUL_EXCEPTION));
|
||||
|
||||
switch ( rc )
|
||||
{
|
||||
case X86EMUL_EXCEPTION:
|
||||
|
||||
@@ -3004,9 +3004,6 @@ static int emulate_privileged_op(struct cpu_user_regs *regs)
|
||||
regs->eflags |= X86_EFLAGS_IF;
|
||||
regs->eflags &= ~X86_EFLAGS_IOPL;
|
||||
|
||||
/* More strict than x86_emulate_wrapper(). */
|
||||
ASSERT(ctxt.ctxt.event_pending == (rc == X86EMUL_EXCEPTION));
|
||||
|
||||
switch ( rc )
|
||||
{
|
||||
case X86EMUL_OKAY:
|
||||
|
||||
@@ -6307,17 +6307,12 @@ int x86_emulate_wrapper(
|
||||
ASSERT(ctxt->regs->r(ip) == orig_ip);
|
||||
|
||||
/*
|
||||
* TODO: Make this true:
|
||||
*
|
||||
ASSERT(ctxt->event_pending == (rc == X86EMUL_EXCEPTION));
|
||||
*
|
||||
* Some codepaths still raise exceptions behind the back of the
|
||||
* emulator. (i.e. return X86EMUL_EXCEPTION but without
|
||||
* event_pending being set). In the meantime, use a slightly
|
||||
* relaxed check...
|
||||
* An event being pending should exactly match returning
|
||||
* X86EMUL_EXCEPTION. (If this trips, the chances are a codepath has
|
||||
* called hvm_inject_hw_exception() rather than using
|
||||
* x86_emul_hw_exception().)
|
||||
*/
|
||||
if ( ctxt->event_pending )
|
||||
ASSERT(rc == X86EMUL_EXCEPTION);
|
||||
ASSERT(ctxt->event_pending == (rc == X86EMUL_EXCEPTION));
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||