|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] x86emul/test: drop an undue conditional
commit 00e074834ee47925151a5b76b4fd0165092907a3
Author: Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Nov 7 12:51:04 2024 +0100
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Nov 7 12:51:04 2024 +0100
x86emul/test: drop an undue conditional
Gating the main part of what do_test() does is wrong: As it stands, the
"memory" forms of BNDC{L,N,U} weren't tested because of this mistake.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
tools/tests/x86_emulator/predicates.c | 53 ++++++++++++++++-------------------
1 file changed, 24 insertions(+), 29 deletions(-)
diff --git a/tools/tests/x86_emulator/predicates.c
b/tools/tests/x86_emulator/predicates.c
index a688081272..270a18e546 100644
--- a/tools/tests/x86_emulator/predicates.c
+++ b/tools/tests/x86_emulator/predicates.c
@@ -2213,42 +2213,37 @@ void do_test(uint8_t *instr, unsigned int len, unsigned
int modrm,
unsigned int bytes,
struct x86_emulate_ctxt *ctxt))
{
- struct x86_emulate_state *s;
+ struct x86_emulate_state *s = x86_decode_insn(ctxt, fetch);
- if ( !modrm || mem != mem_none )
+ if ( !s )
{
- s = x86_decode_insn(ctxt, fetch);
-
- if ( !s )
- {
- print_insn(instr, len);
- printf(" failed to decode\n");
- return;
- }
-
- if ( x86_insn_length(s, ctxt) != len )
- {
- print_insn(instr, len);
- printf(" length %u (expected %u)\n", x86_insn_length(s, ctxt),
len);
- }
+ print_insn(instr, len);
+ printf(" failed to decode\n");
+ return;
+ }
- if ( x86_insn_is_mem_access(s, ctxt) != (mem != mem_none) )
- {
- print_insn(instr, len);
- printf(" mem access %d (expected %d)\n",
- x86_insn_is_mem_access(s, ctxt), mem != mem_none);
- }
+ if ( x86_insn_length(s, ctxt) != len )
+ {
+ print_insn(instr, len);
+ printf(" length %u (expected %u)\n", x86_insn_length(s, ctxt), len);
+ }
- if ( x86_insn_is_mem_write(s, ctxt) != (mem == mem_write) )
- {
- print_insn(instr, len);
- printf(" mem write %d (expected %d)\n",
- x86_insn_is_mem_write(s, ctxt), mem == mem_write);
- }
+ if ( x86_insn_is_mem_access(s, ctxt) != (mem != mem_none) )
+ {
+ print_insn(instr, len);
+ printf(" mem access %d (expected %d)\n",
+ x86_insn_is_mem_access(s, ctxt), mem != mem_none);
+ }
- x86_emulate_free_state(s);
+ if ( x86_insn_is_mem_write(s, ctxt) != (mem == mem_write) )
+ {
+ print_insn(instr, len);
+ printf(" mem write %d (expected %d)\n",
+ x86_insn_is_mem_write(s, ctxt), mem == mem_write);
}
+ x86_emulate_free_state(s);
+
if ( modrm )
{
instr[modrm] |= 0xc0;
--
generated by git-patchbot for /home/xen/git/xen.git#master
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |