hi, i try to implement a simple poly opcode Generator
but i struggle on restoring the Flags.
Axiom:
1)
You don't know the current register and flag value
2)
you are not allowed to push or pop the flags or any register
3)
you can only use add,sub,rol,ror,neg,dec,inc
image you try to replace a
cmp r1_32,imm
the simplest way would be sub r1_32,imm
but i search for a replacement with LEAST 4 commands.
you see the problem, if you don't know the value of a register you may overflow a register during fake arithmetic opcode execution, you will set a carry flag, but a simple
cmp R32,IMM wouldn't do this.
i found no solution for this problem, is there even one ?







