Skip to content

Commit

Permalink
Disable tests for unimplemented instructions in the QEMU test program
Browse files Browse the repository at this point in the history
  • Loading branch information
tbodt committed Nov 19, 2018
1 parent 31ab56b commit d6d5fc9
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 27 deletions.
21 changes: 18 additions & 3 deletions emu/decode.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ __no_instrument DECODER_RET glue(DECODER_NAME, OP_SIZE)(DECODER_ARGS) {
// 2-byte opcode prefix
READINSN;
switch (insn) {
case 0x1f: TRACEI("nop modrm\t"); READMODRM; break;
case 0x18 ... 0x1f: TRACEI("nop modrm\t"); READMODRM; break;

case 0x28: TRACEI("movp modrm, reg");
READMODRM; MOV(modrm_val, modrm_reg,128); break;
Expand Down Expand Up @@ -470,8 +470,11 @@ __no_instrument DECODER_RET glue(DECODER_NAME, OP_SIZE)(DECODER_ARGS) {
READADDR; MOV(reg_a, mem_addr,8); break;
case 0xa3: TRACEI("mov oax, mem\t");
READADDR; MOV(reg_a, mem_addr,oz); break;

case 0xa4: TRACEI("movsb"); STR(movs, 8); break;
case 0xa5: TRACEI("movs"); STR(movs, oz); break;
case 0xa6: TRACEI("cmpsb"); STR(cmps, 8); break;
case 0xa7: TRACEI("cmps"); STR(cmps, oz); break;

case 0xa8: TRACEI("test imm8, al");
READIMM8; TEST(imm, reg_a,8); break;
Expand All @@ -481,6 +484,9 @@ __no_instrument DECODER_RET glue(DECODER_NAME, OP_SIZE)(DECODER_ARGS) {
case 0xaa: TRACEI("stosb"); STR(stos, 8); break;
case 0xab: TRACEI("stos"); STR(stos, oz); break;
case 0xac: TRACEI("lodsb"); STR(lods, 8); break;
case 0xad: TRACEI("lods"); STR(lods, oz); break;
case 0xae: TRACEI("scasb"); STR(scas, 8); break;
case 0xaf: TRACEI("scas"); STR(scas, oz); break;

case 0xb0: TRACEI("mov imm, al\t");
READIMM8; MOV(imm, reg_a,8); break;
Expand Down Expand Up @@ -748,10 +754,15 @@ __no_instrument DECODER_RET glue(DECODER_NAME, OP_SIZE)(DECODER_ARGS) {
case 0x2c: TRACEI("cvttsd2si modrm64, reg32");
READMODRM_MEM; // TODO xmm
CVTTSD2SI(mem_addr_real, modrm_reg); break;
case 0x18 ... 0x1f: TRACEI("rep nop modrm\t"); READMODRM; break;
default: TRACE("undefined"); UNDEFINED;
}
break;

case 0xa6: TRACEI("repnz cmpsb"); REPNZ(cmps, 8); break;
case 0xa7: TRACEI("repnz cmps"); REPNZ(cmps, oz); break;
case 0xae: TRACEI("repnz scasb"); REPNZ(scas, 8); break;
case 0xaf: TRACEI("repnz scas"); REPNZ(scas, oz); break;
default: TRACE("undefined"); UNDEFINED;
}
break;
Expand All @@ -766,6 +777,7 @@ __no_instrument DECODER_RET glue(DECODER_NAME, OP_SIZE)(DECODER_ARGS) {
switch (insn) {
case 0x7e: TRACEI("movq modrm, xmm");
READMODRM; MOVQ(modrm_val, modrm_reg); break;
case 0x18 ... 0x1f: TRACEI("repz nop modrm\t"); READMODRM; break;
default: TRACE("undefined"); UNDEFINED;
}
break;
Expand All @@ -774,11 +786,14 @@ __no_instrument DECODER_RET glue(DECODER_NAME, OP_SIZE)(DECODER_ARGS) {

case 0xa4: TRACEI("rep movsb"); REP(movs, 8); break;
case 0xa5: TRACEI("rep movs"); REP(movs, oz); break;

case 0xa6: TRACEI("repz cmpsb"); REPZ(cmps, 8); break;

case 0xa7: TRACEI("repz cmps"); REPZ(cmps, oz); break;
case 0xaa: TRACEI("rep stosb"); REP(stos, 8); break;
case 0xab: TRACEI("rep stos"); REP(stos, oz); break;
case 0xac: TRACEI("rep lodsb"); REP(lods, 8); break;
case 0xad: TRACEI("rep lods"); REP(lods, oz); break;
case 0xae: TRACEI("repz scasb"); REPZ(scas, 8); break;
case 0xaf: TRACEI("repz scas"); REPZ(scas, oz); break;

// repz ret is equivalent to ret but on some amd chips there's
// a branch prediction penalty if the target of a branch is a
Expand Down
4 changes: 3 additions & 1 deletion tests/qemu-test-shift.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ void exec_opl(long s2, long s0, long s1, long iflags)
stringify(OP) "l", s0, s2, s1, res, iflags, flags & CC_MASK);
}

#if 0
void exec_opw(long s2, long s0, long s1, long iflags)
{
long res, flags;
Expand All @@ -118,6 +119,7 @@ void exec_opw(long s2, long s0, long s1, long iflags)
printf("%-10s A=" FMTLX " B=" FMTLX " C=" FMTLX " R=" FMTLX " CCIN=%04lx CC=%04lx\n",
stringify(OP) "w", s0, s2, s1, res, iflags, flags & CC_MASK);
}
#endif

#endif

Expand Down Expand Up @@ -145,7 +147,7 @@ void exec_op(long s2, long s0, long s1)
#endif
exec_opl(s2, s0, s1, 0);
#ifdef OP_SHIFTD
exec_opw(s2, s0, s1, 0);
//exec_opw(s2, s0, s1, 0);
#else
exec_opw(s2, s0, s1, 0);
#endif
Expand Down
48 changes: 25 additions & 23 deletions tests/qemu-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,13 @@ static inline long i2l(long v)
#define OP ror
#include "qemu-test-shift.h"

#define OP rcr
#define OP_CC
#include "qemu-test-shift.h"
//#define OP rcr
//#define OP_CC
//#include "qemu-test-shift.h"

#define OP rcl
#define OP_CC
#include "qemu-test-shift.h"
//#define OP rcl
//#define OP_CC
//#include "qemu-test-shift.h"

#define OP shld
#define OP_SHIFTD
Expand All @@ -174,6 +174,7 @@ static inline long i2l(long v)
#undef CC_MASK
#define CC_MASK (CC_C)

#if 0
#define OP bt
#define OP_NOBYTE
#include "qemu-test-shift.h"
Expand All @@ -189,6 +190,7 @@ static inline long i2l(long v)
#define OP btc
#define OP_NOBYTE
#include "qemu-test-shift.h"
#endif

/* lea test (modrm support) */
#define TEST_LEAQ(STR)\
Expand Down Expand Up @@ -335,7 +337,7 @@ void test_lea(void)
TEST_LEAQ("0x4000(%%rcx, %%rcx, 2)");
TEST_LEAQ("0x4000(%%rdx, %%rcx, 4)");
TEST_LEAQ("0x4000(%%rsi, %%rcx, 8)");
#else
#elif 0
/* limited 16 bit addressing test */
TEST_LEA16("0x4000");
TEST_LEA16("(%%bx)");
Expand Down Expand Up @@ -1163,6 +1165,7 @@ void test_xchg(void)
TEST_XCHG(xaddw, "w", "+m");
TEST_XCHG(xaddb, "b", "+m");

#if 0
#if defined(__x86_64__)
TEST_CMPXCHG(cmpxchgq, "", "+q", 0xfbca7654);
#endif
Expand All @@ -1176,21 +1179,23 @@ void test_xchg(void)
TEST_CMPXCHG(cmpxchgl, "k", "+q", 0xfffefdfc);
TEST_CMPXCHG(cmpxchgw, "w", "+q", 0xfffefdfc);
TEST_CMPXCHG(cmpxchgb, "b", "+q", 0xfffefdfc);
#endif

#if defined(__x86_64__)
TEST_CMPXCHG(cmpxchgq, "", "+m", 0xfbca7654);
#endif
TEST_CMPXCHG(cmpxchgl, "k", "+m", 0xfbca7654);
TEST_CMPXCHG(cmpxchgw, "w", "+m", 0xfbca7654);
TEST_CMPXCHG(cmpxchgb, "b", "+m", 0xfbca7654);
//TEST_CMPXCHG(cmpxchgw, "w", "+m", 0xfbca7654);
//TEST_CMPXCHG(cmpxchgb, "b", "+m", 0xfbca7654);

#if defined(__x86_64__)
TEST_CMPXCHG(cmpxchgq, "", "+m", 0xfffefdfc);
#endif
TEST_CMPXCHG(cmpxchgl, "k", "+m", 0xfffefdfc);
TEST_CMPXCHG(cmpxchgw, "w", "+m", 0xfffefdfc);
TEST_CMPXCHG(cmpxchgb, "b", "+m", 0xfffefdfc);
//TEST_CMPXCHG(cmpxchgw, "w", "+m", 0xfffefdfc);
//TEST_CMPXCHG(cmpxchgb, "b", "+m", 0xfffefdfc);

#if 0
{
uint64_t op0, op1, op2;
long eax, edx;
Expand All @@ -1214,6 +1219,7 @@ void test_xchg(void)
eax, edx, op1, eflags & CC_Z);
}
}
#endif
}

#ifdef TEST_SEGS
Expand Down Expand Up @@ -1762,11 +1768,7 @@ void test_exceptions(void)
/* bound exception */
tab[0] = 1;
tab[1] = 10;
#ifdef __clang__
asm volatile ("bound %1, %0" : : "r" (11), "m" (tab[0]));
#else
asm volatile ("bound %0, %1" : : "r" (11), "m" (tab[0]));
#endif
}
#endif

Expand Down Expand Up @@ -2736,14 +2738,14 @@ int main(int argc, char **argv)
test_bsx();
test_mul();
test_jcc();
test_loop();
test_floats();
//test_loop();
//test_floats();
#if !defined(__x86_64__)
test_bcd();
//test_bcd();
#endif
test_xchg();
test_string();
test_misc();
//test_misc();
test_lea();
#ifdef TEST_SEGS
test_segs();
Expand All @@ -2753,11 +2755,11 @@ int main(int argc, char **argv)
test_vm86();
#endif
#if !defined(__x86_64__)
test_exceptions();
test_self_modifying_code();
test_single_step();
//test_exceptions();
//test_self_modifying_code();
//test_single_step();
#endif
test_enter();
//test_enter();
test_conv();
#ifdef TEST_SSE
test_sse();
Expand Down

0 comments on commit d6d5fc9

Please sign in to comment.