From 51abc269b3679b9cb0208779042a0ecec9eb4da8 Mon Sep 17 00:00:00 2001 From: Tsuda Kageyu Date: Tue, 12 May 2015 14:32:16 +0900 Subject: [PATCH] Add some comments. --- src/trampoline.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/trampoline.c b/src/trampoline.c index e67a097f..3f9f8db9 100644 --- a/src/trampoline.c +++ b/src/trampoline.c @@ -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 @@ -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;