Main Page | Class List | File List | Class Members | File Members | Related Pages

mach_override.h File Reference

#include <sys/types.h>
#include <mach/error.h>

Go to the source code of this file.

Defines

#define err_cannot_override   (err_local|1)
 Returned if the function to be overrided begins with a 'mfctr' instruction.


Functions

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.


Define Documentation

#define err_cannot_override   (err_local|1)
 

Returned if the function to be overrided begins with a 'mfctr' instruction.

Definition at line 57 of file mach_override.h.

Referenced by mach_override().


Function Documentation

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.

Optionally returns a pointer to a "reentry island" which, if jumped to, will resume the original implementation.

Parameters:
originalFunctionSymbolName -> Required symbol name of the function to override (with overrideFunctionAddress). Remember, C function name symbols are prepended with an underscore.
originalFunctionLibraryNameHint -> Optional name of the library which contains originalFunctionSymbolName. Can be NULL, but this may result in the wrong function being overridden and/or a crash.
overrideFunctionAddress -> Required address to the overriding function.
originalFunctionReentryIsland <- Optional pointer to pointer to the reentry island. Can be NULL.
Returns:
<- err_cannot_override if the original function's implementation begins with the 'mfctr' instruction.

Definition at line 92 of file mach_override.c.

References allocateBranchIsland(), err_cannot_override, freeBranchIsland(), kAllocateHigh, kAllocateNormal, and setBranchIslandTarget().

Referenced by main().


Generated on Sun Jun 12 22:09:33 2005 for mach_override by doxygen 1.3.4