OLD | NEW |
1 /******************************************************************************* | 1 /******************************************************************************* |
2 mach_override.c | 2 mach_override.c |
3 Copyright (c) 2003-2009 Jonathan 'Wolf' Rentzsch: <http://rentzs
ch.com> | 3 Copyright (c) 2003-2009 Jonathan 'Wolf' Rentzsch: <http://rentzs
ch.com> |
4 Some rights reserved: <http://opensource.org/licenses/mit-licens
e.php> | 4 Some rights reserved: <http://opensource.org/licenses/mit-licens
e.php> |
5 | 5 |
6 ************************************************************************
***/ | 6 ************************************************************************
***/ |
7 | 7 |
8 #include "mach_override.h" | 8 #include "mach_override.h" |
9 | 9 |
10 #include <mach-o/dyld.h> | 10 #include <mach-o/dyld.h> |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 assert( island ); | 364 assert( island ); |
365 | 365 |
366 mach_error_t err = err_none; | 366 mach_error_t err = err_none; |
367 | 367 |
368 if( allocateHigh ) { | 368 if( allocateHigh ) { |
369 vm_size_t pageSize; | 369 vm_size_t pageSize; |
370 err = host_page_size( mach_host_self(), &pageSize ); | 370 err = host_page_size( mach_host_self(), &pageSize ); |
371 if( !err ) { | 371 if( !err ) { |
372 assert( sizeof( BranchIsland ) <= pageSize ); | 372 assert( sizeof( BranchIsland ) <= pageSize ); |
373 #if defined(__x86_64__) | 373 #if defined(__x86_64__) |
374 » » » vm_address_t first = (uint64_t)originalFunctionAddress &
~(uint64_t)(((uint64_t)1 << 31) - 1) | ((uint64_t)1 << 31); // start in the mid
dle of the page? | 374 » » » vm_address_t first = ((uint64_t)originalFunctionAddress
& ~(uint64_t)(((uint64_t)1 << 31) - 1)) | ((uint64_t)1 << 31); // start in the m
iddle of the page? |
375 vm_address_t last = 0x0; | 375 vm_address_t last = 0x0; |
376 #else | 376 #else |
377 vm_address_t first = 0xffc00000; | 377 vm_address_t first = 0xffc00000; |
378 vm_address_t last = 0xfffe0000; | 378 vm_address_t last = 0xfffe0000; |
379 #endif | 379 #endif |
380 | 380 |
381 vm_address_t page = first; | 381 vm_address_t page = first; |
382 int allocated = 0; | 382 int allocated = 0; |
383 vm_map_t task_self = mach_task_self(); | 383 vm_map_t task_self = mach_task_self(); |
384 | 384 |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 ); | 699 ); |
700 #elif defined(__x86_64__) | 700 #elif defined(__x86_64__) |
701 void atomic_mov64( | 701 void atomic_mov64( |
702 uint64_t *targetAddress, | 702 uint64_t *targetAddress, |
703 uint64_t value ) | 703 uint64_t value ) |
704 { | 704 { |
705 *targetAddress = value; | 705 *targetAddress = value; |
706 } | 706 } |
707 #endif | 707 #endif |
708 #endif | 708 #endif |
OLD | NEW |