]> xenbits.xensource.com Git - xen.git/commit
x86/pv: Introduce and use x86emul_read_dr()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 23 Mar 2018 20:13:50 +0000 (20:13 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 17 Apr 2018 14:12:36 +0000 (15:12 +0100)
commit881f8dc4314809293efc6f66f9af49734994bf0e
tree5c2f73d3f68dcbcdb1fb9a0fda6877d7a180ad84
parenta6aa678fa380e9369cc44701a181142322b3a4b0
x86/pv: Introduce and use x86emul_read_dr()

do_get_debugreg() has several bugs:

 * The %cr4.de condition is inverted.  %dr4/5 should be accessible only when
   %cr4.de is disabled.
 * When %cr4.de is disabled, emulation should yield #UD rather than complete
   with zero.
 * Using -EINVAL for errors is a broken ABI, as it overlaps with valid values
   near the top of the address space.

Introduce a common x86emul_read_dr() handler (as we will eventually want to
add HVM support) which separates its success/failure indication from the data
value, and have do_get_debugreg() call into the handler.

The ABI of do_get_debugreg() remains broken, but switches from -EINVAL to
-ENODEV for compatibility with the changes in the following patch.

Take the opportunity to add a missing local variable block to x86_emulate.c

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
xen/arch/x86/pv/emul-priv-op.c
xen/arch/x86/pv/misc-hypercalls.c
xen/arch/x86/x86_emulate.c
xen/arch/x86/x86_emulate/x86_emulate.h