From b93c962740b6cfdd7fab933f5a5d7f77c47d5ff7 Mon Sep 17 00:00:00 2001 From: noahd Date: Thu, 15 May 2014 03:16:46 +0200 Subject: [PATCH 1/2] Add support for relative call instructions in reentry island --- mach_override.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mach_override.c b/mach_override.c index 85a75e5..9cffcc5 100644 --- a/mach_override.c +++ b/mach_override.c @@ -641,7 +641,8 @@ fixupInstructions( int index; for (index = 0;index < instructionCount;index += 1) { - if (*(uint8_t*)instructionsToFix == 0xE9) // 32-bit jump relative + uint8_t opcode = *(uint8_t*)instructionsToFix; + if ((opcode == 0xE9) || (opcode == 0xE8)) // 32-bit jump/call relative { uint32_t offset = (uintptr_t)originalFunction - (uintptr_t)escapeIsland; uint32_t *jumpOffsetPtr = (uint32_t*)((uintptr_t)instructionsToFix + 1); From 7233e39c5095079286f6b033a938c9d948248844 Mon Sep 17 00:00:00 2001 From: noahd Date: Thu, 15 May 2014 16:07:03 +0200 Subject: [PATCH 2/2] Fix whitespace --- mach_override.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mach_override.c b/mach_override.c index 9cffcc5..de857ad 100644 --- a/mach_override.c +++ b/mach_override.c @@ -641,7 +641,7 @@ fixupInstructions( int index; for (index = 0;index < instructionCount;index += 1) { - uint8_t opcode = *(uint8_t*)instructionsToFix; + uint8_t opcode = *(uint8_t*)instructionsToFix; if ((opcode == 0xE9) || (opcode == 0xE8)) // 32-bit jump/call relative { uint32_t offset = (uintptr_t)originalFunction - (uintptr_t)escapeIsland;