#if defined(__ppc__) || defined(__POWERPC__)
+static
long kIslandTemplate[] = {
0x9001FFFC, // stw r0,-4(SP)
0x3C00DEAD, // lis r0,0xDEAD
#define kOriginalInstructionsSize 16
+static
char kIslandTemplate[] = {
// kOriginalInstructionsSize nop instructions so that we
// should have enough space to host original instructions
#define kJumpAddress kOriginalInstructionsSize + 6
+static
char kIslandTemplate[] = {
// kOriginalInstructionsSize nop instructions so that we
// should have enough space to host original instructions
#pragma mark -
#pragma mark (Funky Protos)
- mach_error_t
+
+ static mach_error_t
allocateBranchIsland(
BranchIsland **island,
int allocateHigh,
void *originalFunctionAddress) __attribute__((visibility("hidden")));
- mach_error_t
+ static mach_error_t
freeBranchIsland(
BranchIsland *island ) __attribute__((visibility("hidden")));
- mach_error_t
+ static mach_error_t
defaultIslandMalloc(
void **ptr, size_t unused_size, void *hint) __attribute__((visibility("hidden")));
- mach_error_t
+ static mach_error_t
defaultIslandFree(
void *ptr) __attribute__((visibility("hidden")));
#if defined(__ppc__) || defined(__POWERPC__)
- mach_error_t
+ static mach_error_t
setBranchIslandTarget(
BranchIsland *island,
const void *branchTo,
#endif
#if defined(__i386__) || defined(__x86_64__)
-mach_error_t
+static mach_error_t
setBranchIslandTarget_i386(
BranchIsland *island,
const void *branchTo,
char* instructions ) __attribute__((visibility("hidden")));
+// Can't be made static because there's no C implementation for atomic_mov64
+// on i386.
void
atomic_mov64(
uint64_t *targetAddress,
#pragma mark (Interface)
#if defined(__i386__) || defined(__x86_64__)
-mach_error_t makeIslandExecutable(void *address) {
+static mach_error_t makeIslandExecutable(void *address) {
mach_error_t err = err_none;
vm_size_t pageSize;
host_page_size( mach_host_self(), &pageSize );
}
#endif
- mach_error_t
+ static mach_error_t
defaultIslandMalloc(
void **ptr, size_t unused_size, void *hint) {
return allocateBranchIsland( (BranchIsland**)ptr, kAllocateHigh, hint );
}
- mach_error_t
+ static mach_error_t
defaultIslandFree(
void *ptr) {
return freeBranchIsland(ptr);
***************************************************************************/
- mach_error_t
+ static mach_error_t
allocateBranchIsland(
BranchIsland **island,
int allocateHigh,
***************************************************************************/
- mach_error_t
+ static mach_error_t
freeBranchIsland(
BranchIsland *island )
{
***************************************************************************/
#if defined(__ppc__) || defined(__POWERPC__)
- mach_error_t
+ static mach_error_t
setBranchIslandTarget(
BranchIsland *island,
const void *branchTo,
#endif
#if defined(__i386__)
- mach_error_t
+ static mach_error_t
setBranchIslandTarget_i386(
BranchIsland *island,
const void *branchTo,
}
#elif defined(__x86_64__)
-mach_error_t
+static mach_error_t
setBranchIslandTarget_i386(
BranchIsland *island,
const void *branchTo,