Skip to content

Commit

Permalink
Add some comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
TsudaKageyu committed May 12, 2015
1 parent 9cccb28 commit 51abc26
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/trampoline.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ BOOL CreateTrampolineFunction(PTRAMPOLINE ct)
{
UINT8 cond = ((hs.opcode != 0x0F ? hs.opcode : hs.opcode2) & 0x0F);
#ifdef _M_X64
// Invert the condition.
// Invert the condition in x64 mode to simplify the conditional jump logic.
jcc.opcode = 0x71 ^ cond;
jcc.address = dest;
#else
Expand All @@ -253,9 +253,11 @@ BOOL CreateTrampolineFunction(PTRAMPOLINE ct)
if (pOldInst < jmpDest && copySize != hs.len)
return FALSE;

// Trampoline function is too large.
if ((newPos + copySize) > TRAMPOLINE_MAX_SIZE)
return FALSE;

// Trampoline function has too many instructions.
if (ct->nIP >= ARRAYSIZE(ct->oldIPs))
return FALSE;

Expand Down

0 comments on commit 51abc26

Please sign in to comment.