x86/emul: Provide a wrapper to x86_emulate() to ASSERT() certain behaviour
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 29 Nov 2016 18:46:56 +0000 (18:46 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 2 Dec 2016 17:23:01 +0000 (17:23 +0000)
commit3e84c8da7d2c5442a12789dae7163dca6c0e154f
tree1cb8333e95698c2c354c37efa3babdc6c988dcfc
parent8d246db03eaa339c88e04ba5bea356164ea26d2a
x86/emul: Provide a wrapper to x86_emulate() to ASSERT() certain behaviour

In debug builds, confirm that some properties of x86_emulate()'s behaviour
actually hold.  The first property, fixed in a previous change, is that retire
flags are only ever set in the X86EMUL_OKAY case.

While adjusting the userspace test harness to cope with ASSERT() in
x86_emulate.h, fix a build problem introduced in c/s 122dd9575c7 "x86emul:
in_longmode() should not ignore ->read_msr() errors" by providing an
implementation of likely()/unlikely().

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
tools/tests/x86_emulator/test_x86_emulator.c
tools/tests/x86_emulator/x86_emulate.c
xen/arch/x86/x86_emulate/x86_emulate.c
xen/arch/x86/x86_emulate/x86_emulate.h