Test multiple byte nopl (from 1-byte nopl to 9-byte nopl) in 64-bit mode. Signed-off-by: Arthur Chunqi Li <yzt356@xxxxxxxxx> --- x86/emulator.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/x86/emulator.c b/x86/emulator.c index 6972334..bd02d5c 100755 --- a/x86/emulator.c +++ b/x86/emulator.c @@ -816,6 +816,30 @@ static void test_movabs(uint64_t *mem, uint8_t *alt_insn_page) report("64-bit mov imm2", outregs.rcx == 0x9090909090909090); } +static void test_nopl(uint64_t *mem, void *alt_insn_page) +{ + MK_INSN(nopl1, ".byte 0x90\n\r"); /* 1 byte nop */ + MK_INSN(nopl2, ".byte 0x66, 0x90\n\r"); /* 2 byte nop */ + MK_INSN(nopl3, ".byte 0x0f, 0x1f, 0x00\n\r"); /* 3 byte nop */ + MK_INSN(nopl4, ".byte 0x0f, 0x1f, 0x40, 0x00\n\r"); /* 4 byte nop */ + MK_INSN(nopl5, ".byte 0x0f, 0x1f, 0x44, 0x00, 0x00\n\r"); /* 5 byte nop */ + MK_INSN(nopl6, ".byte 0x66, 0x0f, 0x1f, 0x44, 0x00, 0x00\n\r"); /* 6 byte nop */ + MK_INSN(nopl7, ".byte 0x0f, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00\n\r"); /* 7 byte nop */ + MK_INSN(nopl8, ".byte 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00\n\r"); /* 8 byte nop */ + MK_INSN(nopl9, ".byte 0x66, 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00\n\r"); /* 9 byte nop */ + + trap_emulator(mem, alt_insn_page, &insn_nopl1); + trap_emulator(mem, alt_insn_page, &insn_nopl2); + trap_emulator(mem, alt_insn_page, &insn_nopl3); + trap_emulator(mem, alt_insn_page, &insn_nopl4); + trap_emulator(mem, alt_insn_page, &insn_nopl5); + trap_emulator(mem, alt_insn_page, &insn_nopl6); + trap_emulator(mem, alt_insn_page, &insn_nopl7); + trap_emulator(mem, alt_insn_page, &insn_nopl8); + trap_emulator(mem, alt_insn_page, &insn_nopl9); + report("nopl", 1); +} + static void test_crosspage_mmio(volatile uint8_t *mem) { volatile uint16_t w, *pw; @@ -1012,6 +1036,7 @@ int main() test_mmx_movq_mf(mem, alt_insn_page); test_movabs(mem, alt_insn_page); + test_nopl(mem, alt_insn_page); test_crosspage_mmio(mem); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html