Ejemplo n.º 1
0
 public MCoreRewriter(MCoreArchitecture arch, EndianImageReader rdr, ProcessorState state, IStorageBinder binder, IRewriterHost host)
 {
     this.arch   = arch;
     this.rdr    = rdr;
     this.state  = state;
     this.binder = binder;
     this.host   = host;
     this.dasm   = new MCoreDisassembler(arch, rdr).GetEnumerator();
     this.instr  = null !;
     this.m      = null !;
 }
Ejemplo n.º 2
0
        public IEnumerator <RtlInstructionCluster> GetEnumerator()
        {
            while (dasm.MoveNext())
            {
                this.instr  = dasm.Current;
                this.iclass = instr.InstructionClass;
                var rtls = new List <RtlInstruction>();
                this.m = new RtlEmitter(rtls);
                switch (instr.Mnemonic)
                {
                default:
                    host.Warn(instr.Address, "MCore instruction {0} not supported yet.", this.instr);
                    EmitUnitTest();
                    goto case Mnemonic.invalid;

                case Mnemonic.invalid: m.Invalid(); iclass = InstrClass.Invalid; break;
                }
                yield return(m.MakeCluster(instr.Address, instr.Length, this.iclass));
            }
        }