Skip to content

Commit

Permalink
fix sahf
Browse files Browse the repository at this point in the history
  • Loading branch information
NaC-L committed Oct 22, 2024
1 parent 38fea20 commit f0d07b2
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions lifter/Semantics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3451,17 +3451,20 @@ void lifterClass::lift_sahf() {
auto ah = GetRegisterValue(ZYDIS_REGISTER_AH);
// RFLAGS(SF:ZF:0:AF:0:PF:1:CF) := AH;
//
auto cf =
createAndFolder(ah, ConstantInt::get(ah->getType(), (1 << FLAG_CF)));
printvalue(GetRegisterValue(ZYDIS_REGISTER_RAX));
printvalue(ah);
Value* one = ConstantInt::get(ah->getType(), 1);
auto cf = createAndFolder(
createLShrFolder(ah, ConstantInt::get(ah->getType(), FLAG_CF)), one);
// + 2
auto pf =
createAndFolder(ah, ConstantInt::get(ah->getType(), (1 << FLAG_PF)));
auto af =
createAndFolder(ah, ConstantInt::get(ah->getType(), (1 << FLAG_AF)));
auto zf =
createAndFolder(ah, ConstantInt::get(ah->getType(), (1 << FLAG_ZF)));
auto sf =
createAndFolder(ah, ConstantInt::get(ah->getType(), (1 << FLAG_SF)));
auto pf = createAndFolder(
createLShrFolder(ah, ConstantInt::get(ah->getType(), FLAG_PF)), one);
auto af = createAndFolder(
createLShrFolder(ah, ConstantInt::get(ah->getType(), FLAG_AF)), one);
auto zf = createAndFolder(
createLShrFolder(ah, ConstantInt::get(ah->getType(), FLAG_ZF)), one);
auto sf = createAndFolder(
createLShrFolder(ah, ConstantInt::get(ah->getType(), FLAG_SF)), one);
setFlag(FLAG_CF, cf);
setFlag(FLAG_PF, pf);
setFlag(FLAG_AF, af);
Expand Down

0 comments on commit f0d07b2

Please sign in to comment.