x86/emul: Implement singlestep as a retire flag
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 29 Nov 2016 17:56:17 +0000 (17:56 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 2 Dec 2016 17:23:01 +0000 (17:23 +0000)
commit1d60efc574854e0f10502d8d8f7820af0823cec3
tree12872f56d42dc295d0e45eed9c4c7f91247e144e
parent346f43dbf36856f5ad030b229592283ce44af1d4
x86/emul: Implement singlestep as a retire flag

The behaviour of singlestep is to raise #DB after the instruction has been
completed, but implementing it with inject_hw_exception() causes x86_emulate()
to return X86EMUL_EXCEPTION, despite succesfully completing execution of the
instruction, including register writeback.

Instead, use a retire flag to indicate singlestep, which causes x86_emulate()
to return X86EMUL_OKAY.

Update all callers of x86_emulate() to use the new retire flag.  This fixes
the behaviour of singlestep for shadow pagetable updates and mmcfg/mmio_ro
intercepts, which previously discarded the exception.

With this change, all uses of X86EMUL_EXCEPTION from x86_emulate() are
believed to have strictly fault semantics.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/hvm/emulate.c
xen/arch/x86/mm.c
xen/arch/x86/mm/shadow/multi.c
xen/arch/x86/x86_emulate/x86_emulate.c
xen/arch/x86/x86_emulate/x86_emulate.h