x86emul: generalize exception handling for rep_* hooks
authorJan Beulich <jbeulich@suse.com>
Wed, 14 Dec 2016 08:52:35 +0000 (09:52 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 14 Dec 2016 08:52:35 +0000 (09:52 +0100)
commit53f87c03b4ead25df97ccfbeaeddc78ff8375c91
tree16c1f0540fe092da5d0c06cce789d49bbcb55fb8
parent653cae725cea44c867bb450617da3b08596287ff
x86emul: generalize exception handling for rep_* hooks

If any of those hooks returns X86EMUL_EXCEPTION, some register state
should still get updated if some iterations have been performed (but
the rIP update will get suppressed if not all of them did get handled).
This updating is done by register_address_increment() and
__put_rep_prefix() (which hence must no longer be bypassed). As a
result put_rep_prefix() can then skip most of the writeback, but needs
to ensure proper completion of the executed instruction.

While on the HVM side the VA -> LA -> PA translation process ensures
that an exception would be raised on the first iteration only, doing so
would unduly complicate the PV side code about to be added.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
xen/arch/x86/hvm/emulate.c
xen/arch/x86/x86_emulate/x86_emulate.c