Пример #1
0
def x86_loopne(ctx, i):
    c = conditional.condition(ctx, conditional.NE)
    dst = operand.get(ctx, i, 0)

    tmp0 = ctx.tmp(8)

    ctx.emit(sub_(ctx.counter, imm(1, ctx.counter.size), ctx.counter))
    ctx.emit(equ_(ctx.counter, imm(0, ctx.counter.size), tmp0))
    ctx.emit(or_(c, tmp0, c))
    ctx.emit(jcc_(c, dst))
Пример #2
0
def x86_loopne(ctx, i):
    c = conditional.condition(ctx, conditional.NE)
    dst = operand.get(ctx, i, 0)

    tmp0 = ctx.tmp(8)

    ctx.emit(  sub_  (ctx.counter, imm(1, ctx.counter.size), ctx.counter))
    ctx.emit(  equ_  (ctx.counter, imm(0, ctx.counter.size), tmp0))
    ctx.emit(  or_   (c, tmp0, c))
    ctx.emit(  jcc_  (c, dst))
Пример #3
0
def conditional_mov(ctx, i, condition):
    c = conditional.condition(ctx, condition)

    value = None

    if len(i.operands) == 1:
        # source is the accumulator
        value = ctx.accumulator
    else:
        value = operand.get(ctx, i, 1)

    ctx.emit(  jcc_  (c, 'do_mov'))
    ctx.emit(  jcc_  (imm(1, 8), 'done'))

    ctx.emit('do_mov')
    operand.set(ctx, i, 0, value, clear=True)

    ctx.emit('done')
    ctx.emit(  nop_())
Пример #4
0
def conditional_set(ctx, i, condition):
    c = conditional.condition(ctx, condition)
    operand.set(ctx, i, 0, c)
Пример #5
0
def conditional_jump(ctx, i, condition):
    c = conditional.condition(ctx, condition)
    dst = operand.get(ctx, i, 0)

    ctx.emit(jcc_(c, dst))
Пример #6
0
def conditional_jump(ctx, i, condition):
    c = conditional.condition(ctx, condition)
    dst = operand.get(ctx, i, 0)

    ctx.emit(  jcc_   (c, dst))
Пример #7
0
def conditional_set(ctx, i, condition):
    c = conditional.condition(ctx, condition)
    operand.set(ctx, i, 0, c)