…patched or might otherwise contain relative jmp instructions. This fixes incompatibility with Rogue Amoeba's Instant On component.
…ile. It looks like it's based on obsolete code.
--- Go back to pre-51ae3d199463fa84548f466d649f0821d579fdaf branch islands for PowerPC. Because PowerPC uses ba (branch absolute) to jump to branch islands, the islands must be somewhere in the lowest or highest 32MB of address space.
--- Some cleanup (better suited for production use). Some additions. Also to stderr instead of stdout. Not sure if you want to merge this (or how you think about such changes). Those are just my changes I have laying around here. I think I also will comment out my additions later on (because it works good now for me) and maybe you want to wait for that before merging.
--- see bug #11 Im not sure if you want to merge this already. But this is what works on 10.7, so maybe it is better to have this in right now (with this comment or some other comment) and add some further code later on if there are problems for other people.
…s for PowerPC. Because PowerPC uses ba (branch absolute) to jump to branch islands, the islands must be somewhere in the lowest or highest 32MB of address space.
On 10.5, malloc_error_break is a whopping five instructions long: 0x01e314ae <malloc_error_break+0>: push %ebp 0x01e314af <malloc_error_break+1>: mov %esp,%ebp 0x01e314b1 <malloc_error_break+3>: leave 0x01e314b2 <malloc_error_break+4>: ret If you want to patch this, the normal facilities by which mach_override works will not hook this because it does not eat leave/ret, for good reason. This adds the whole body of the above assembly to the beginning of possibleInstructions so that if you override a method like this, it succeeds. On 10.6 and 10.7, the assembly has changed to include two nop instructions, making it large enough to override.
…de the __FILE__ to make the source clear.
… Lion. There seems to be some double indirection before getting to the actual function. In 32 bits: jmp .+0x???????? then jmp *0x???????? In 64 bits: jmp .+0x???????? then jmp qword near [rip+0x????????] The fix works for both 32 and 64 bits. This could be addressed outside of mach_star, but then it would not be possible to use the MACH_OVERRIDE macro. Also, small (potential) bug fix: try making islands executable *before* planting the jmp.