Instantiate disassembler after max_xlen is known
authorAndrew Waterman <andrew@sifive.com>
Tue, 21 Aug 2018 21:24:23 +0000 (14:24 -0700)
committerAndrew Waterman <andrew@sifive.com>
Tue, 21 Aug 2018 21:25:53 +0000 (14:25 -0700)
This fixes RVC disassembly.

It's done in a way that doesn't break 2cd60b277e909a5599ca48e4561cbfbc61460186

riscv/processor.cc

index ecbe3ef483dc5b15c9102d62498eff2cce12b67b..8bcd8e2cc9dfcf4e0cca5c4fe2d0c5f093815083 100644 (file)
@@ -24,12 +24,16 @@ processor_t::processor_t(const char* isa, simif_t* sim, uint32_t id,
   : debug(false), halt_request(false), sim(sim), ext(NULL), id(id),
   halt_on_reset(halt_on_reset), last_pc(1), executions(1)
 {
-  disassembler = new disassembler_t(max_xlen);
   parse_isa_string(isa);
   register_base_instructions();
 
   mmu = new mmu_t(sim, this);
 
+  disassembler = new disassembler_t(max_xlen);
+  if (ext)
+    for (auto disasm_insn : ext->get_disasms())
+      disassembler->add_insn(disasm_insn);
+
   reset();
 }