示例#1
0
        public virtual void make(CpuState cpu)
        {
            pc = cpu.pc;
            for (int i = 0; i < NUMBER_REGISTERS; i++)
            {
                gpr[i] = cpu.getRegister(i);
            }
            threadID   = Modules.ThreadManForUserModule.CurrentThreadID;
            threadName = Modules.ThreadManForUserModule.getThreadName(threadID);

            Memory mem = MemoryViewer.Memory;

            if (MemoryViewer.isAddressGood(cpu.pc))
            {
                opcode = mem.read32(cpu.pc);
                Common.Instruction insn = Decoder.instruction(opcode);
                asm = insn.disasm(cpu.pc, opcode);
            }
            else
            {
                opcode = 0;
                asm    = "?";
            }

            dirty = true;
        }
示例#2
0
        public static bool isEndBlockInsn(int pc, int opcode, Common.Instruction insn)
        {
            if (insn.hasFlags(Common.Instruction.FLAG_ENDS_BLOCK))
            {
                if (insn.hasFlags(Common.Instruction.FLAG_IS_CONDITIONAL | Common.Instruction.FLAG_IS_BRANCHING))
                {
                    // Detect the conditional
                    //    "BEQ $xx, $xx, target"
                    // which is equivalent to the unconditional
                    //    "B target"
                    if (insn == Instructions.BEQ)
                    {
                        int rt = (opcode >> 16) & 0x1F;
                        int rs = (opcode >> 21) & 0x1F;
                        if (rs == rt)
                        {
                            return(true);
                        }
                    }
                    else
                    {
                        Console.WriteLine(string.Format("Unknown conditional instruction ending a block: {0}", insn.disasm(pc, opcode)));
                    }
                }
                else
                {
                    return(true);
                }
            }

            return(false);
        }