#include "mach_override.h"
#include <mach-o/dyld.h>
#include <mach/mach_host.h>
#include <mach/mach_init.h>
#include <mach/vm_map.h>
#include <sys/mman.h>
#include <CoreServices/CoreServices.h>
Go to the source code of this file.
Classes | |
| struct | BranchIsland |
Defines | |
| #define | kAddressHi 3 |
| #define | kAddressLo 5 |
| #define | kInstructionHi 10 |
| #define | kInstructionLo 11 |
| #define | kAllocateHigh 1 |
| #define | kAllocateNormal 0 |
| #define | kMFCTRMask 0xfc1fffff |
| #define | kMFCTRInstruction 0x7c0903a6 |
Functions | |
| mach_error_t | allocateBranchIsland (BranchIsland **island, int allocateHigh) |
| Implementation: Allocates memory for a branch island. | |
| mach_error_t | freeBranchIsland (BranchIsland *island) |
| Implementation: Deallocates memory for a branch island. | |
| mach_error_t | setBranchIslandTarget (BranchIsland *island, const void *branchTo, long instruction) |
| Implementation: Sets the branch island's target, with an optional instruction. | |
| mach_error_t | mach_override (char *originalFunctionSymbolName, const char *originalFunctionLibraryNameHint, const void *overrideFunctionAddress, void **originalFunctionReentryIsland) |
| Dynamically overrides the function implementation referenced by originalFunctionSymbolName with the implentation pointed to by overrideFunctionAddress. | |
Variables | |
| long | kIslandTemplate [] |
|
|
Definition at line 39 of file mach_override.c. Referenced by setBranchIslandTarget(). |
|
|
Definition at line 40 of file mach_override.c. Referenced by setBranchIslandTarget(). |
|
|
Definition at line 44 of file mach_override.c. Referenced by mach_override(). |
|
|
Definition at line 45 of file mach_override.c. Referenced by mach_override(). |
|
|
Definition at line 41 of file mach_override.c. Referenced by setBranchIslandTarget(). |
|
|
Definition at line 42 of file mach_override.c. Referenced by setBranchIslandTarget(). |
|
|
|
|
|
|
|
||||||||||||
|
Implementation: Allocates memory for a branch island.
Definition at line 218 of file mach_override.c. References BranchIsland::allocatedHigh. Referenced by mach_override(). |
|
|
Implementation: Deallocates memory for a branch island.
Definition at line 273 of file mach_override.c. References BranchIsland::allocatedHigh, BranchIsland::instructions, and kIslandTemplate. Referenced by mach_override(). |
|
||||||||||||||||||||
|
Dynamically overrides the function implementation referenced by originalFunctionSymbolName with the implentation pointed to by overrideFunctionAddress. Optionally returns a pointer to a "reentry island" which, if jumped to, will resume the original implementation.
Definition at line 92 of file mach_override.c. References allocateBranchIsland(), err_cannot_override, freeBranchIsland(), kAllocateHigh, kAllocateNormal, and setBranchIslandTarget(). Referenced by main(). |
|
||||||||||||||||
|
Implementation: Sets the branch island's target, with an optional instruction.
Definition at line 311 of file mach_override.c. References BranchIsland::instructions, kAddressHi, kAddressLo, kInstructionHi, kInstructionLo, and kIslandTemplate. Referenced by mach_override(). |
|
|
Initial value: {
0x9001FFFC,
0x3C00DEAD,
0x6000BEEF,
0x7C0903A6,
0x8001FFFC,
0x60000000,
0x4E800420
}
Definition at line 30 of file mach_override.c. Referenced by freeBranchIsland(), and setBranchIslandTarget(). |
1.3.4