| 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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 #if defined(__i386__) || defined(__x86_64__) | 523 #if defined(__i386__) || defined(__x86_64__) |
| 524 // simplistic instruction matching | 524 // simplistic instruction matching |
| 525 typedef struct { | 525 typedef struct { |
| 526 unsigned int length; // max 15 | 526 unsigned int length; // max 15 |
| 527 unsigned char mask[15]; // sequence of bytes in memory order | 527 unsigned char mask[15]; // sequence of bytes in memory order |
| 528 unsigned char constraint[15]; // sequence of bytes in memory order | 528 unsigned char constraint[15]; // sequence of bytes in memory order |
| 529 } AsmInstructionMatch; | 529 } AsmInstructionMatch; |
| 530 | 530 |
| 531 #if defined(__i386__) | 531 #if defined(__i386__) |
| 532 static AsmInstructionMatch possibleInstructions[] = { | 532 static AsmInstructionMatch possibleInstructions[] = { |
| 533 { 0x5, {0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, {0x55, 0x89, 0xe5, 0xc9, 0xc3} },
// push %ebp; mov %esp,%ebp; leave; ret |
| 533 { 0x1, {0xFF}, {0x90} },
// nop | 534 { 0x1, {0xFF}, {0x90} },
// nop |
| 534 { 0x1, {0xFF}, {0x55} },
// push %esp | 535 { 0x1, {0xFF}, {0x55} },
// push %esp |
| 535 { 0x2, {0xFF, 0xFF}, {0x89, 0xE5} },
// mov %esp,%ebp | 536 { 0x2, {0xFF, 0xFF}, {0x89, 0xE5} },
// mov %esp,%ebp |
| 536 { 0x1, {0xFF}, {0x53} },
// push %ebx | 537 { 0x1, {0xFF}, {0x53} },
// push %ebx |
| 537 { 0x3, {0xFF, 0xFF, 0x00}, {0x83, 0xEC, 0x00} },
// sub 0x??, %esp | 538 { 0x3, {0xFF, 0xFF, 0x00}, {0x83, 0xEC, 0x00} },
// sub 0x??, %esp |
| 538 { 0x6, {0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00}, {0x81, 0xEC, 0x00, 0x00, 0x
00, 0x00} }, // sub 0x??, %esp with 32bit immediate | 539 { 0x6, {0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00}, {0x81, 0xEC, 0x00, 0x00, 0x
00, 0x00} }, // sub 0x??, %esp with 32bit immediate |
| 539 { 0x1, {0xFF}, {0x57} },
// push %edi | 540 { 0x1, {0xFF}, {0x57} },
// push %edi |
| 540 { 0x1, {0xFF}, {0x56} },
// push %esi | 541 { 0x1, {0xFF}, {0x56} },
// push %esi |
| 541 { 0x2, {0xFF, 0xFF}, {0x31, 0xC0} },
// xor %eax, %eax | 542 { 0x2, {0xFF, 0xFF}, {0x31, 0xC0} },
// xor %eax, %eax |
| 542 { 0x3, {0xFF, 0x4F, 0x00}, {0x8B, 0x45, 0x00} }, // mov $imm(%ebp), %re
g | 543 { 0x3, {0xFF, 0x4F, 0x00}, {0x8B, 0x45, 0x00} }, // mov $imm(%ebp), %re
g |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 ); | 681 ); |
| 681 #elif defined(__x86_64__) | 682 #elif defined(__x86_64__) |
| 682 void atomic_mov64( | 683 void atomic_mov64( |
| 683 uint64_t *targetAddress, | 684 uint64_t *targetAddress, |
| 684 uint64_t value ) | 685 uint64_t value ) |
| 685 { | 686 { |
| 686 *targetAddress = value; | 687 *targetAddress = value; |
| 687 } | 688 } |
| 688 #endif | 689 #endif |
| 689 #endif | 690 #endif |
| OLD | NEW |