MahdiSafsafi / UnivDisasm

x86 Disassembler and Analyzer
Mozilla Public License 2.0
92 stars 34 forks source link

BUG #15

Closed hksoobe closed 7 years ago

hksoobe commented 7 years ago

bug EFlags is error

MahdiSafsafi commented 7 years ago

Hello, Please provide full opcode of the instruction.

hksoobe commented 7 years ago

image

Maybe I did not understand your design ideas What does "1 4 8" mean? 1 is not changed? 8 is modified? 4 is read?

MahdiSafsafi commented 7 years ago

Hi again ! EFlags is a struct (record) of element (ZF,OF,...). Each element is represented as a combination of "EF_X" flag were EF_X could be :

{ EFlags }
  EF_N = $01; // Instruction does not affect flag.
  EF_U = $02; // Instruction's effect on flag is undefined.
  EF_T = $04; // Instruction tests flag.
  EF_M = $08; // Instruction modifies flag (either sets or resets depending on operands).
  EF_R = $10; // Instruction resets flag.
  EF_S = $20; // Instruction sets flag.
  EF_P = $40; // Instruction restores prior value of flag.
  EF_TM = EF_T or EF_M;

So you need to test against those flags to see whether the flag is set or not. SF = 4 => instruction TESTS flag SF. ZF = 8 => instruction MODIFIES flag ZF. SF = 12 => means (SF = (4 or 8)) => instruction TESTS AND MODIFIES flag SF.

Please, close the issue if this comment solved your problem. PS: Everything was enplaned in the source (TInstruction).

Regrads, Mahdi.

hksoobe commented 7 years ago

thank you very much