Skip to content

Commit

Permalink
Custom registers read/written for the 'call' instruction
Browse files Browse the repository at this point in the history
  • Loading branch information
mrexodia committed Jul 6, 2024
1 parent 461e8ce commit 1594c0d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions obfuscator/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,15 @@ struct Context
data->flagsModified = flags.set0 | flags.set1 | flags.modified | flags.undefined;
data->flagsTested = flags.tested;

if (detail.getCategory() == x86::Category::Call)
{
// The call instruction clobbers all volatile registers
data->regsWritten = regMask(x86::rax) | regMask(x86::rcx) | regMask(x86::rdx)
| regMask(x86::r8) | regMask(x86::r9) | regMask(x86::r10) | regMask(x86::r11);
// The call instruction reads the first 4 arguments from rcx, rdx, r8, r9
data->regsRead = regMask(x86::rcx) | regMask(x86::rdx) | regMask(x86::r8) | regMask(x86::r9);
}

node->setUserData(data);
}
return data;
Expand Down

0 comments on commit 1594c0d

Please sign in to comment.