def METHOD_NAME(self, emu, op, eip):
    if self.arch is None:
        self.arch = op.iflags & envi.ARCH_MASK
    if self.arch == envi.ARCH_I386:
        if op.opcode == INS_OUT:
            emu.stopEmu()
            raise v_exc.BadOutInstruction(op.va)
        if op.opcode == INS_TRAP:
            reg = emu.getRegister(envi.archs.i386.REG_EAX)
            if reg == 1:
                emu.stopEmu()
                self.vw.addNoReturnVa(eip)
    if self.arch == envi.ARCH_AMD64:
        if op.opcode == INS_OUT:
            emu.stopEmu()
            raise v_exc.BadOutInstruction(op.va)
    if op in self.badops:
        emu.stopEmu()
        raise v_exc.BadOpBytes(op.va)
    if op.iflags & envi.IF_RET:
        self.hasret = True
        emu.stopEmu()
    self.lastop = op
    loc = self.vw.getLocation(eip)
    if loc is not None:
        va, size, ltype, linfo = loc
        if ltype != vivisect.LOC_OP:
            emu.stopEmu()
            raise Exception("HIT LOCTYPE %d AT 0x%.8x" % (ltype, va))
    cnt = self.mndist.get(op.mnem, 0)
    self.mndist[op.mnem] = cnt + 1
    self.insn_count += 1
    if self.vw.isNoReturnVa(eip):
        self.hasret = True
        emu.stopEmu()
    # FIXME do we need a way to terminate emulation here?