fuzz_with_unicorn: Correct GenRandomInst
UnallocatedEncoding is now handled in ShouldTestInst
This commit is contained in:
parent
7969871aa3
commit
c490a45af6
1 changed files with 4 additions and 3 deletions
|
@ -61,7 +61,7 @@ static bool ShouldTestInst(u32 instruction, u64 pc, bool is_last_inst) {
|
||||||
|
|
||||||
static u32 GenRandomInst(u64 pc, bool is_last_inst) {
|
static u32 GenRandomInst(u64 pc, bool is_last_inst) {
|
||||||
static const std::vector<InstructionGenerator> instruction_generators = []{
|
static const std::vector<InstructionGenerator> instruction_generators = []{
|
||||||
const std::vector<std::tuple<const char*, const char*>> list {
|
const std::vector<std::tuple<std::string, const char*>> list {
|
||||||
#define INST(fn, name, bitstring) {#fn, bitstring},
|
#define INST(fn, name, bitstring) {#fn, bitstring},
|
||||||
#include "frontend/A64/decoder/a64.inc"
|
#include "frontend/A64/decoder/a64.inc"
|
||||||
#undef INST
|
#undef INST
|
||||||
|
@ -71,8 +71,6 @@ static u32 GenRandomInst(u64 pc, bool is_last_inst) {
|
||||||
|
|
||||||
// List of instructions not to test
|
// List of instructions not to test
|
||||||
const std::vector<std::string> do_not_test {
|
const std::vector<std::string> do_not_test {
|
||||||
// Unallocated encodings are invalid.
|
|
||||||
"UnallocatedEncoding",
|
|
||||||
// Unimplemented in QEMU
|
// Unimplemented in QEMU
|
||||||
"STLLR",
|
"STLLR",
|
||||||
// Unimplemented in QEMU
|
// Unimplemented in QEMU
|
||||||
|
@ -82,6 +80,9 @@ static u32 GenRandomInst(u64 pc, bool is_last_inst) {
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const auto& [fn, bitstring] : list) {
|
for (const auto& [fn, bitstring] : list) {
|
||||||
|
if (fn == "UnallocatedEncoding") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (std::find(do_not_test.begin(), do_not_test.end(), fn) != do_not_test.end()) {
|
if (std::find(do_not_test.begin(), do_not_test.end(), fn) != do_not_test.end()) {
|
||||||
InstructionGenerator::AddInvalidInstruction(bitstring);
|
InstructionGenerator::AddInvalidInstruction(bitstring);
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in a new issue