From 8416da49d7c0b37e8166db48b3c65a26a8ef9242 Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Sun, 6 Nov 2011 07:28:10 +0100 Subject: [PATCH] Analyze phase done. Plugin should now be mostly functional. --- TODO | 1 - gcdsp.py | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) delete mode 100644 TODO diff --git a/TODO b/TODO deleted file mode 100644 index d4b225e..0000000 --- a/TODO +++ /dev/null @@ -1 +0,0 @@ -* Emulate operands diff --git a/gcdsp.py b/gcdsp.py index e439bf4..703f8be 100644 --- a/gcdsp.py +++ b/gcdsp.py @@ -335,11 +335,26 @@ class GCDSPProcessor(processor_t): cmd.itype = instr.id return cmd.size + def _emu_operand(self, op): + """Emulated using one operand from the instruction.""" + if op.type == o_mem: + ua_dodata2(0, op.addr, op.dtyp) + ua_add_dref(0, op.addr, dr_R) # TODO: dr_W ? + elif op.type == o_near: + if self.cmd.get_canon_feature() & CF_CALL: + fl = fl_CN + else: + fl = fl_JN + ua_add_cref(0, op.addr, fl) + def emu(self): """Emulate instruction behavior and create x-refs, interpret operand values, etc.""" instr = self.instrs_list[self.cmd.itype] + for i in xrange(len(instr.all_operands)): + self._emu_operand(self.cmd[i]) + if not instr.stops: # add a link to next instr if code continues ua_add_cref(0, self.cmd.ea + self.cmd.size, fl_F)