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

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

Issue 1234393005: A mechanism to identify/forbid/"rewrite" non-temporal instructions (and other) (Closed) Base URL: https://chromium.googlesource.com/native_client/src/native_client.git@master
Patch Set: Fixing nits Created 5 years, 4 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) 2013 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2013 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 #include <stdarg.h> 7 #include <stdarg.h>
8 #include <stdio.h> 8 #include <stdio.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 10
(...skipping 27 matching lines...) Expand all
38 }; 38 };
39 39
40 40
41 Bool ExtractRestrictedRegisterCallback( 41 Bool ExtractRestrictedRegisterCallback(
42 const uint8_t *begin, 42 const uint8_t *begin,
43 const uint8_t *end, 43 const uint8_t *end,
44 uint32_t info, 44 uint32_t info,
45 void *data) { 45 void *data) {
46 46
47 struct CallbackData *callback_data = data; 47 struct CallbackData *callback_data = data;
48 /* UNSUPPORTED_INSTRUCTION indicates validation failure only for pnacl-mode.
49 * Since by default we are in non-pnacl-mode, the flag is simply cleared.
50 */
51 info &= ~UNSUPPORTED_INSTRUCTION;
52
48 if (end <= callback_data->actual_end && (info & VALIDATION_ERRORS_MASK)) { 53 if (end <= callback_data->actual_end && (info & VALIDATION_ERRORS_MASK)) {
49 callback_data->valid = FALSE; 54 callback_data->valid = FALSE;
50 } 55 }
51 if (end == callback_data->actual_end) { 56 if (end == callback_data->actual_end) {
52 callback_data->restricted_register = 57 callback_data->restricted_register =
53 (info & RESTRICTED_REGISTER_MASK) >> RESTRICTED_REGISTER_SHIFT; 58 (info & RESTRICTED_REGISTER_MASK) >> RESTRICTED_REGISTER_SHIFT;
54 } 59 }
55 if (begin < callback_data->actual_end && callback_data->actual_end < end) { 60 if (begin < callback_data->actual_end && callback_data->actual_end < end) {
56 /* Instruction crosses actual chunk boundary. */ 61 /* Instruction crosses actual chunk boundary. */
57 callback_data->valid = FALSE; 62 callback_data->valid = FALSE;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 ValidateChunkAMD64( 95 ValidateChunkAMD64(
91 codeblock, size, 96 codeblock, size,
92 options, 97 options,
93 cpu_features, 98 cpu_features,
94 ExtractRestrictedRegisterCallback, 99 ExtractRestrictedRegisterCallback,
95 &callback_data); 100 &callback_data);
96 101
97 *resulting_restricted_register = callback_data.restricted_register; 102 *resulting_restricted_register = callback_data.restricted_register;
98 return callback_data.valid; 103 return callback_data.valid;
99 } 104 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698