OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 /* Implement the functions common for ia32 and x86-64 architectures. */ | 7 /* Implement the functions common for ia32 and x86-64 architectures. */ |
8 #include "native_client/src/trusted/validator_ragel/dfa_validate_common.h" | 8 #include "native_client/src/trusted/validator_ragel/dfa_validate_common.h" |
9 | 9 |
10 #include <string.h> | 10 #include <string.h> |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 return TRUE; | 76 return TRUE; |
77 } | 77 } |
78 | 78 |
79 #if NACL_BUILD_SUBARCH == 32 | 79 #if NACL_BUILD_SUBARCH == 32 |
80 UNREFERENCED_PARAMETER(info); | 80 UNREFERENCED_PARAMETER(info); |
81 | 81 |
82 if (size >= 2 && memcmp(ptr, "\x0f\xe7", 2) == 0) { | 82 if (size >= 2 && memcmp(ptr, "\x0f\xe7", 2) == 0) { |
83 /* movntq => movq */ | 83 /* movntq => movq */ |
84 ptr[1] = 0x7f; | 84 ptr[1] = 0x7f; |
85 return TRUE; | 85 return TRUE; |
| 86 } else if (size >= 2 && memcmp(ptr, "\x0f\x2b", 2) == 0) { |
| 87 /* movntps => movaps */ |
| 88 ptr[1] = 0x29; |
| 89 return TRUE; |
86 } else if (size >= 3 && memcmp(ptr, "\x66\x0f\xe7", 3) == 0) { | 90 } else if (size >= 3 && memcmp(ptr, "\x66\x0f\xe7", 3) == 0) { |
87 /* movntdq => movdqa */ | 91 /* movntdq => movdqa */ |
88 ptr[2] = 0x7f; | 92 ptr[2] = 0x7f; |
89 return TRUE; | 93 return TRUE; |
90 } | 94 } |
91 #elif NACL_BUILD_SUBARCH == 64 | 95 #elif NACL_BUILD_SUBARCH == 64 |
92 if (size >= 3 && IsREXPrefix(ptr[0]) && ptr[1] == 0x0f) { | 96 if (size >= 3 && IsREXPrefix(ptr[0]) && ptr[1] == 0x0f) { |
93 uint8_t opcode_byte2 = ptr[2]; | 97 uint8_t opcode_byte2 = ptr[2]; |
94 switch (opcode_byte2) { | 98 switch (opcode_byte2) { |
95 case 0xe7: | 99 case 0xe7: |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 | 283 |
280 Bool NaClDfaCodeReplacementIsStubouted(const uint8_t *begin_existing, | 284 Bool NaClDfaCodeReplacementIsStubouted(const uint8_t *begin_existing, |
281 size_t instruction_length) { | 285 size_t instruction_length) { |
282 | 286 |
283 /* Unsupported instruction must have been replaced with HLTs. */ | 287 /* Unsupported instruction must have been replaced with HLTs. */ |
284 if (memcmp(kStubOutMem, begin_existing, instruction_length) == 0) | 288 if (memcmp(kStubOutMem, begin_existing, instruction_length) == 0) |
285 return TRUE; | 289 return TRUE; |
286 else | 290 else |
287 return FALSE; | 291 return FALSE; |
288 } | 292 } |
OLD | NEW |