Thursday, April 14, 2011 [Tweets] [Favorites]

Implementing imp_implementationWithBlock()

Landon Fuller explains Apple’s implementation of imp_implementationWithBlock() and posted his own PLBlockIMP, which works on Mac OS X 10.6:

On Darwin, vm_remap() provides support for mapping an existing code page at new address, while retaining the existing page protections; using vm_remap(), we can create multiple copies of existing, executable code, placed at arbitrary addresses. If we generate a template page filled with trampolines at build time, we can create arbitrary duplicates of that page at runtime. This allows us to allocate an arbitrary number of trampolines using that template without requiring writable code…

Comments

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment