for (val = vals; val->name; val++) { if (!strcmp(val->name, branch_str)) return val->val;
}
pr_debug("Failed to get branch\n");
return -1;
}
staticint test_data_item(conststruct test_data *dat, int x86_64)
{ struct intel_pt_insn intel_pt_insn; int op, branch, ret; struct insn insn;
ret = insn_decode(&insn, dat->data, MAX_INSN_SIZE,
x86_64 ? INSN_MODE_64 : INSN_MODE_32); if (ret < 0) {
pr_debug("Failed to decode: %s\n", dat->asm_rep); return -1;
}
if (insn.length != dat->expected_length) {
pr_debug("Failed to decode length (%d vs expected %d): %s\n",
insn.length, dat->expected_length, dat->asm_rep); return -1;
}
op = get_op(dat->expected_op_str);
branch = get_branch(dat->expected_branch_str);
if (intel_pt_get_insn(dat->data, MAX_INSN_SIZE, x86_64, &intel_pt_insn)) {
pr_debug("Intel PT failed to decode: %s\n", dat->asm_rep); return -1;
}
if ((int)intel_pt_insn.op != op) {
pr_debug("Failed to decode 'op' value (%d vs expected %d): %s\n",
intel_pt_insn.op, op, dat->asm_rep); return -1;
}
if ((int)intel_pt_insn.branch != branch) {
pr_debug("Failed to decode 'branch' value (%d vs expected %d): %s\n",
intel_pt_insn.branch, branch, dat->asm_rep); return -1;
}
if (intel_pt_insn.rel != dat->expected_rel) {
pr_debug("Failed to decode 'rel' value (%#x vs expected %#x): %s\n",
intel_pt_insn.rel, dat->expected_rel, dat->asm_rep); return -1;
}
pr_debug("Decoded ok: %s\n", dat->asm_rep);
return 0;
}
staticint test_data_set(conststruct test_data *dat_set, int x86_64)
{ conststruct test_data *dat; int ret = 0;
for (dat = dat_set; dat->expected_length; dat++) { if (test_data_item(dat, x86_64))
ret = -1;
}
return ret;
}
/** * test__insn_x86 - test x86 instruction decoder - new instructions. * * This function implements a test that decodes a selection of instructions and * checks the results. The Intel PT function that further categorizes * instructions (i.e. intel_pt_get_insn()) is also checked. * * The instructions are originally in insn-x86-dat-src.c which has been * processed by scripts gen-insn-x86-dat.sh and gen-insn-x86-dat.awk to produce * insn-x86-dat-32.c and insn-x86-dat-64.c which are included into this program. * i.e. to add new instructions to the test, edit insn-x86-dat-src.c, run the * gen-insn-x86-dat.sh script, make perf, and then run the test. * * If the test passes %0 is returned, otherwise %-1 is returned. Use the * verbose (-v) option to see all the instructions and whether or not they * decoded successfully.
*/ int test__insn_x86(struct test_suite *test __maybe_unused, int subtest __maybe_unused)
{ int ret = 0;
if (test_data_set(test_data_32, 0))
ret = -1;
if (test_data_set(test_data_64, 1))
ret = -1;
return ret;
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.22 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.