aboutsummaryrefslogtreecommitdiffstats
path: root/tools/tests/x86_emulator
Commit message (Collapse)AuthorAgeFilesLines
* x86_emulate: fix flag setting for 8-bit signed multiplicationJan Beulich2013-09-201-0/+2
| | | | | | | | | | | | | | | We really need to check for a signed overflow of 8 bits, while the previous check compared the sign-extended 8-bit result with the zero-extended 16-bit one (which was wrong for all negative results). Once at it - also adjust the 16-bit comparison for symmetry - improve the 8-bit multiplication (no need to zero-extend to 32-bits the sign-extended to 16 bits original 8-bit value) - fold both signed multiplication variants Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* x86_emulate: MOVSXD must read source operand just onceJan Beulich2013-09-201-4/+62
| | | | | | | | | | | | ... for the case of accessing MMIO. Also streamline the ARPL emulation a little, and add tests for both instructions (the MOVSXD one requires a few other adjustments, as we now need to run in a mode where the emulator's mode_64bit() returns true). Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* x86: fix dependencies of emulator testJan Beulich2013-09-201-6/+5
| | | | | | | | | | | | Rather than mentioning the (linked) directory, mention the files thus making sure things get rebuild as needed when the core emulator files change. Also enable debug info generation unconditionally, as this is testing stuff only anyway. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* x86: AVX instruction emulation fixesJan Beulich2013-08-281-6/+138
| | | | | | | | | | | | | | | | | | | - we used the C4/C5 (first prefix) byte instead of the apparent ModR/M one as the second prefix byte - early decoding normalized vex.reg, thus corrupting it for the main consumer (copy_REX_VEX()), resulting in #UD on the two-operand instructions we emulate Also add respective test cases to the testing utility plus - fix get_fpu() (the fall-through order was inverted) - add cpu_has_avx2, even if it's currently unused (as in the new test cases I decided to refrain from using AVX2 instructions in order to be able to actually run all the tests on the hardware I have) - slightly tweak cpu_has_avx to more consistently express the outputs we don't care about (sinking them all into the same variable) Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* x86: save/restore only partial register state where possibleJan Beulich2012-10-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | ... and make restore conditional not only upon having saved the state, but also upon whether saved state was actually modified (and register values are known to have been preserved). Note that RBP is unconditionally considered a volatile register (i.e. irrespective of CONFIG_FRAME_POINTER), since the RBP handling would become overly complicated due to the need to save/restore it on the compat mode hypercall path [6th argument]. Note further that for compat mode code paths, saving/restoring R8...R15 is entirely unnecessary - we don't allow those guests to enter 64-bit mode, and hence they have no way of seeing these registers' contents (and there consequently also is no information leak, except if the context saving domctl would be considered such). Finally, note that this may not properly deal with gdbstub's needs, yet (but if so, I can't really suggest adjustments, as I don't know that code). Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* x86/emulator: workaround for AMD erratum 573Jan Beulich2011-12-161-0/+2
| | | | | | | | | | | | | | | | | The only cases where we might end up emulating fsincos (as any other x87 operations without memory operands) are - when a HVM guest is in real mode (not applicable on AMD) - between two half page table updates in PAE mode (unlikely, and not doing the emulation here does affect only performance, not correctness) - when a guest maliciously (or erroneously) modifies an (MMIO or page table update) instruction under emulation (unspecified behavior) Hence, in order to avoid the erratum to cause harm to the entire host, don't emulate fsincos on the affected AMD CPU families. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* x86/emulator: add emulation of SIMD FP movesJan Beulich2011-12-011-0/+54
| | | | | | | | | | Clone the existing movq emulation to also support the most fundamental SIMD FP moves. Extend the testing code to also exercise these instructions. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* x86/emulator: generalize movq emulation (SSE2 and AVX variants)Jan Beulich2011-12-011-0/+187
| | | | | | | | | | | | Extend the existing movq emulation to also support its SSE2 and AVX variants, the latter implying the addition of VEX decoding. Fold the read and write cases (as most of the logic is identical), and add movntq and variants (as they're very similar). Extend the testing code to also exercise these instructions. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* test_x86_emulator: add a "run" target to the test code makefileJan Beulich2011-11-161-0/+4
| | | | | Signed-off-by: Jan Beulich <jbeulich@suse.com> Committed-by: Keir Fraser <keir@xen.org>
* x86_emulate: Define and use BUG() and bool_t.Keir Fraser2011-11-161-0/+6
| | | | | Original patch by Jan Beulich <jbeulich@suse.com> Signed-off-by: Keir Fraser <keir@xen.org>
* test_x86_emulate: Get public Xen headers via tools/include.Keir Fraser2011-11-163-4/+6
| | | | Signed-off-by: Keir Fraser <keir@xen.org>
* x86-64/test_x86_emulate: fix blowfish testJan Beulich2011-11-161-1/+1
| | | | | | | | Incorrect register usage in the _start() wrapper caused the 64-bit execution emulation to fail. Signed-off-by: Jan Beulich <jbeulich@suse.com> Committed-by: Keir Fraser <keir@xen.org>
* build: Make XEN_ROOT an absolute path.Keir Fraser2011-03-172-2/+2
| | | | | | | | Otherwise make can search the path relative to certain standard paths such as /usr/include (e.g., the line '-include $(XEN_ROOT)/.config' in Config.mk suffers from this). Signed-off-by: Keir Fraser <keir@xen.org>
* tools/tests: Move x86 emulator tests into a subdirKeir Fraser2011-01-085-0/+1011
Signed-off-by: Keir Fraser <keir@xen.org> --HG-- rename : tools/tests/Makefile => tools/tests/x86_emulator/Makefile rename : tools/tests/blowfish.c => tools/tests/x86_emulator/blowfish.c rename : tools/tests/blowfish.mk => tools/tests/x86_emulator/blowfish.mk rename : tools/tests/test_x86_emulator.c => tools/tests/x86_emulator/test_x86_emulator.c rename : tools/tests/x86_emulate.c => tools/tests/x86_emulator/x86_emulate.c