Skip to content

Commit

Permalink
i#6744: Use xrstors32 and xsaves32 for invariant checker test on x86-…
Browse files Browse the repository at this point in the history
…32. (#6747)

tool.drcachesim.invariant_checker_test fails on x86-32 with the
following error:

1/371 Test #11:
tool.drcachesim.invariant_checker_test
...........................***Failed 0.04 sec

Recording |Too many read records| in T1 @ ref # 16 (6 instrs since
timestamp 0)
Recording |Too many read records| in T1 @ ref # 17 (6 instrs since
timestamp 0)
Recording |Too many read records| in T1 @ ref # 18 (6 instrs since
timestamp 0)
Recording |Too many read records| in T1 @ ref # 19 (6 instrs since
timestamp 0)
Recording |Too many write records| in T1 @ ref # 21 (7 instrs since
timestamp 0)
Recording |Too many write records| in T1 @ ref # 22 (7 instrs since
timestamp 0)
Recording |Too many write records| in T1 @ ref # 23 (7 instrs since
timestamp 0)
Recording |Too many write records| in T1 @ ref # 24 (7 instrs since
timestamp 0)
Unexpected error: Too many read records at ref: 16
Unexpected error: Too many read records at ref: 17
Unexpected error: Too many read records at ref: 18
Unexpected error: Too many read records at ref: 19
Unexpected error: Too many write records at ref: 21
Unexpected error: Too many write records at ref: 22
Unexpected error: Too many write records at ref: 23
Unexpected error: Too many write records at ref: 24

OP_xsaves64 and OP_xrstors32 are marked as o64 (X86_INVALID) in
core/ir/x86/decode_table.c.

instr_is_xsave() and instr_is_xrstor() return false on x86-32, hence not
skipping the number of read/write record check in the invariant check on
x86_32.

Use xrstors32 and xsaves32 instead for the test on x86_32.

Fixes #6744
  • Loading branch information
ivankyluk authored Mar 29, 2024
1 parent e698fa3 commit 086b0ce
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions clients/drcachesim/tests/invariant_checker_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3272,12 +3272,21 @@ check_kernel_syscall_trace(void)
instr_t *sti = INSTR_CREATE_sti(GLOBAL_DCONTEXT);
instr_t *nop1 = XINST_CREATE_nop(GLOBAL_DCONTEXT);
instr_t *nop2 = XINST_CREATE_nop(GLOBAL_DCONTEXT);
# if defined(X64)
instr_t *xrstors = INSTR_CREATE_xrstors64(
GLOBAL_DCONTEXT,
opnd_create_base_disp(DR_REG_XCX, DR_REG_NULL, 0, 0, OPSZ_xsave));
instr_t *xsaves = INSTR_CREATE_xsaves64(
GLOBAL_DCONTEXT,
opnd_create_base_disp(DR_REG_XCX, DR_REG_NULL, 0, 0, OPSZ_xsave));
# else
instr_t *xrstors = INSTR_CREATE_xrstors32(
GLOBAL_DCONTEXT,
opnd_create_base_disp(DR_REG_XCX, DR_REG_NULL, 0, 0, OPSZ_xsave));
instr_t *xsaves = INSTR_CREATE_xsaves32(
GLOBAL_DCONTEXT,
opnd_create_base_disp(DR_REG_XCX, DR_REG_NULL, 0, 0, OPSZ_xsave));
# endif
instr_t *hlt = INSTR_CREATE_hlt(GLOBAL_DCONTEXT);
instr_t *nop3 = XINST_CREATE_nop(GLOBAL_DCONTEXT);
instr_t *prefetch = INSTR_CREATE_prefetchnta(
Expand Down

0 comments on commit 086b0ce

Please sign in to comment.