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

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

Issue 1269113003: Rewrite non-temporal instructions Base URL: https://chromium.googlesource.com/native_client/src/native_client.git@master
Patch Set: Format 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) 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 /* 7 /*
8 * This file contains common parts of x86-32 and x86-64 internals (inline 8 * This file contains common parts of x86-32 and x86-64 internals (inline
9 * and static functions and defines). 9 * and static functions and defines).
10 */ 10 */
11 11
12 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_RAGEL_DFA_VALIDATE_COMMON_H_ 12 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_RAGEL_DFA_VALIDATE_COMMON_H_
13 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_RAGEL_DFA_VALIDATE_COMMON_H_ 13 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_RAGEL_DFA_VALIDATE_COMMON_H_
14 14
15 #include <stddef.h> 15 #include <stddef.h>
16 16
17 #include "native_client/src/shared/utils/types.h" 17 #include "native_client/src/shared/utils/types.h"
18 #include "native_client/src/trusted/validator/ncvalidate.h" 18 #include "native_client/src/trusted/validator/ncvalidate.h"
19 #include "native_client/src/trusted/validator_ragel/validator.h"
19 20
20 /* 21 /*
21 * ia32 or x86-64 instructions can not be longer than 15 bytes, but we have some 22 * ia32 or x86-64 instructions can not be longer than 15 bytes, but we have some
22 * superinstructions which are 17 bytes long, e.g.: 23 * superinstructions which are 17 bytes long, e.g.:
23 * 0: 40 89 f6 rex mov %esi,%esi 24 * 0: 40 89 f6 rex mov %esi,%esi
24 * 3: 49 8d 34 37 lea (%r15,%rsi,1),%rsi 25 * 3: 49 8d 34 37 lea (%r15,%rsi,1),%rsi
25 * 7: 40 89 ff rex mov %edi,%edi 26 * 7: 40 89 ff rex mov %edi,%edi
26 * a: 49 8d 3c 3f lea (%r15,%rdi,1),%rdi 27 * a: 49 8d 3c 3f lea (%r15,%rdi,1),%rdi
27 * e: f2 48 a7 repnz cmpsq %es:(%rdi),%ds:(%rsi) 28 * e: f2 48 a7 repnz cmpsq %es:(%rdi),%ds:(%rsi)
28 */ 29 */
29 #define MAX_INSTRUCTION_LENGTH 17 30 #define MAX_INSTRUCTION_LENGTH 17
30 31
31 Bool NaClDfaProcessValidationError(const uint8_t *begin, const uint8_t *end, 32 Bool NaClDfaProcessValidationError(const uint8_t *begin, const uint8_t *end,
32 uint32_t info, void *callback_data); 33 uint32_t info, void *callback_data);
33 34
34 struct StubOutCallbackData { 35 struct StubOutCallbackData {
36 /* input parameters */
35 uint32_t flags; 37 uint32_t flags;
38 uint32_t chunk_processed_as_a_contiguous_stream;
39 uint32_t bundle_begin_offset;
40 NaClCPUFeaturesX86 *cpu_features;
41 /* output parameters */
36 int did_rewrite; 42 int did_rewrite;
37 }; 43 };
38 44
39 Bool NaClDfaStubOutUnsupportedInstruction(const uint8_t *begin, 45 Bool NaClDfaStubOutUnsupportedInstruction(const uint8_t *begin,
40 const uint8_t *end, 46 const uint8_t *end,
41 uint32_t info, 47 uint32_t info,
42 void *callback_data); 48 void *callback_data);
43 49
44 struct CodeCopyCallbackData { 50 struct CodeCopyCallbackData {
45 NaClCopyInstructionFunc copy_func; 51 NaClCopyInstructionFunc copy_func;
46 /* Difference between addresses: dest - src. */ 52 /* Difference between addresses: dest - src. */
47 ptrdiff_t existing_minus_new; 53 ptrdiff_t existing_minus_new;
48 }; 54 };
49 55
50 Bool NaClDfaProcessCodeCopyInstruction(const uint8_t *begin_new, 56 Bool NaClDfaProcessCodeCopyInstruction(const uint8_t *begin_new,
51 const uint8_t *end_new, 57 const uint8_t *end_new,
52 uint32_t info, 58 uint32_t info,
53 void *callback_data); 59 void *callback_data);
54 60
55 /* Check whether instruction is stubouted because it is not supported by current 61 /* Check whether instruction is stubouted because it is not supported by current
56 CPU. */ 62 CPU. */
57 Bool NaClDfaCodeReplacementIsStubouted(const uint8_t *begin_existing, 63 Bool NaClDfaCodeReplacementIsStubouted(const uint8_t *begin_existing,
58 size_t instruction_length); 64 size_t instruction_length);
59 65
60 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_RAGEL_DFA_VALIDATE_COMMON_H_ */ 66 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_RAGEL_DFA_VALIDATE_COMMON_H_ */
OLDNEW
« no previous file with comments | « src/trusted/validator_ragel/dfa_validate_64.c ('k') | src/trusted/validator_ragel/dfa_validate_common.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698