Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(258)

Side by Side Diff: src/trusted/validator_ragel/dfa_validate_common.c

Issue 1863433002: x86 validator: Implement rewriting "movntq" to "movq" on x86-64 (Closed) Base URL: https://chromium.googlesource.com/native_client/src/native_client.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 return TRUE; 85 return TRUE;
86 } else if (size >= 3 && memcmp(ptr, "\x66\x0f\xe7", 3) == 0) { 86 } else if (size >= 3 && memcmp(ptr, "\x66\x0f\xe7", 3) == 0) {
87 /* movntdq => movdqa */ 87 /* movntdq => movdqa */
88 ptr[2] = 0x7f; 88 ptr[2] = 0x7f;
89 return TRUE; 89 return TRUE;
90 } 90 }
91 #elif NACL_BUILD_SUBARCH == 64 91 #elif NACL_BUILD_SUBARCH == 64
92 if (size >= 3 && IsREXPrefix(ptr[0]) && ptr[1] == 0x0f) { 92 if (size >= 3 && IsREXPrefix(ptr[0]) && ptr[1] == 0x0f) {
93 uint8_t opcode_byte2 = ptr[2]; 93 uint8_t opcode_byte2 = ptr[2];
94 switch (opcode_byte2) { 94 switch (opcode_byte2) {
95 case 0xe7:
96 /* movntq => movq */
97 ptr[2] = 0x7f;
98 return TRUE;
95 case 0x2b: 99 case 0x2b:
96 /* movntps => movaps */ 100 /* movntps => movaps */
97 ptr[2] = 0x29; 101 ptr[2] = 0x29;
98 return TRUE; 102 return TRUE;
99 case 0xc3: 103 case 0xc3:
100 /* movnti => mov, nop */ 104 /* movnti => mov, nop */
101 if ((info & RESTRICTED_REGISTER_USED) != 0) { 105 if ((info & RESTRICTED_REGISTER_USED) != 0) {
102 /* 106 /*
103 * The rewriting for movnti is special because it changes 107 * The rewriting for movnti is special because it changes
104 * instruction boundary: movnti is replaced by a mov and a nop so 108 * instruction boundary: movnti is replaced by a mov and a nop so
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 279
276 Bool NaClDfaCodeReplacementIsStubouted(const uint8_t *begin_existing, 280 Bool NaClDfaCodeReplacementIsStubouted(const uint8_t *begin_existing,
277 size_t instruction_length) { 281 size_t instruction_length) {
278 282
279 /* Unsupported instruction must have been replaced with HLTs. */ 283 /* Unsupported instruction must have been replaced with HLTs. */
280 if (memcmp(kStubOutMem, begin_existing, instruction_length) == 0) 284 if (memcmp(kStubOutMem, begin_existing, instruction_length) == 0)
281 return TRUE; 285 return TRUE;
282 else 286 else
283 return FALSE; 287 return FALSE;
284 } 288 }
OLDNEW
« no previous file with comments | « src/trusted/validator/validation_rewrite_test_data.S ('k') | tests/validator/rewrite_nontemporals.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698