Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def conditional_jump(ctx, i, condition):
c = conditional.condition(ctx, condition)
dst = operand.get(ctx, i, 0)
ctx.emit( jcc_ (c, dst))
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')
def conditional_set(ctx, i, condition):
c = conditional.condition(ctx, condition)
operand.set(ctx, i, 0, c)
def x86_jo(ctx, i):
"""jump if overflow"""
conditional_jump(ctx, i, conditional.O)
def x86_setno(ctx, i):
"""set if not overflow"""
conditional_set(ctx, i, conditional.NO)
def x86_cmovl(ctx, i):
"""mov if less"""
conditional_mov(ctx, i, conditional.L)