Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/GT-3534_ghidorahrex_x86_AF_flag_…
Browse files Browse the repository at this point in the history
…inconsistencies'
  • Loading branch information
GhidorahRex committed Mar 4, 2020
2 parents 534fd52 + 222b42a commit f4ce863
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Ghidra/Processors/x86/data/languages/ia.sinc
Original file line number Diff line number Diff line change
Expand Up @@ -1229,25 +1229,23 @@ macro addCarryFlags ( op1, op2 ) {
local CFcopy = zext(CF);
CF = carry( op1, op2 );
OF = scarry( op1, op2 );
local AFmask = -1 >> 4;
AF = (((op1 & AFmask) + (op2 & AFmask) + CFcopy) & (AFmask + 1)) != 0;
local result = op1 + op2;
CF = CF || carry( result, CFcopy );
OF = OF ^^ scarry( result, CFcopy );
op1 = result + CFcopy;
# AF not implemented
}


macro subCarryFlags ( op1, op2 ) {
local CFcopy = zext(CF);
CF = op1 < op2;
OF = sborrow( op1, op2 );
local AFmask = -1 >> 4;
AF = (((op1 & AFmask) - (op2 & AFmask) - CFcopy) & (AFmask + 1)) != 0;
local result = op1 - op2;
CF = CF || (result < CFcopy);
OF = OF ^^ sborrow( result, CFcopy );
op1 = result - CFcopy;
# AF not implemented
}

macro resultflags(result) {
Expand Down

0 comments on commit f4ce863

Please sign in to comment.