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

Side by Side Diff: src/trusted/validator_x86/ncenuminsts.h

Issue 625923004: Delete old x86 validator. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
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
4 * found in the LICENSE file.
5 */
6
7 /* Helper routines for testing instructions. Used by private_tests/enuminsts. */
8
9 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCEMNUMINSTS_H_
10 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCEMNUMINSTS_H_
11
12 #ifndef NACL_TRUSTED_BUT_NOT_TCB
13 #error("This file is not meant for use in the TCB")
14 #endif
15
16 #include "native_client/src/shared/utils/types.h"
17 #include "native_client/src/trusted/validator/types_memory_model.h"
18
19 /* Parameterize the decoder state by architecture. */
20 #if NACL_TARGET_SUBARCH == 64
21 struct NaClInstState;
22 #define NaClInstStruct struct NaClInstState
23 #else
24 struct NCDecoderState;
25 #define NaClInstStruct struct NCDecoderState
26 #endif
27
28 /* Decodes the first instruction in the given buffer, assuming the
29 * given vbase.
30 * WARNING: This function is not thread safe. The resulting instruction
31 * is only guaranteed to be defined until the next call to this function.
32 * NOTE: Since this is only used by private_tests/enuminsts, which is a
33 * singly threaded application, not being thread safe is ok.
34 */
35 NaClInstStruct *NaClParseInst(uint8_t *ibytes, size_t isize,
36 const NaClPcAddress vbase);
37
38 /* Returns the number of bytes in the given (parsed) instruction. */
39 uint8_t NaClInstLength(NaClInstStruct *inst);
40
41 /* Returns the printed text for the given instruction (including parsed bytes)
42 * as a (malloc allocated) char*.
43 */
44 char* NaClInstToStr(NaClInstStruct *inst);
45
46 /* Return true if the instruction in num_bytes (of bytes) validates. */
47 Bool NaClValidateAnalyzeBytes(uint8_t *bytes,
48 NaClMemorySize num_bytes,
49 NaClPcAddress base);
50
51 /* Returns the name of the opcode for the given instruction
52 * WARNING: This function is not thread safe. The resulting string
53 * is only guaranteed to be defined until the next call to this function.
54 * NOTE: Since this is only used by private_tests/enuminsts, which is a
55 * singly threaded application, not being thread safe is ok.
56 */
57 const char *NaClOpcodeName(NaClInstStruct *inst);
58
59 /* Returns true if the instruction was properly decoded by the NaCl
60 * disassembler.
61 */
62 Bool NaClInstDecodesCorrectly(NaClInstStruct *inst);
63
64 /* Returns true if the instruction, defined by SIZE bytes
65 * in the given base, validates as a legal NACL instruction,
66 * to the best we can tell without surrounding context. That is,
67 * we only do static checks on the instruction, and do not check
68 * preconditions/postconditions of the instruction.
69 *
70 * Parameters are:
71 * mbase - The memory containing the bytes of the instruction to decode.
72 * size - The number of bytes defining the instruction.
73 * vbase - The virtual address associated with the instruction.
74 * inst - The decoded instruction from NaClParseInst above.
75 */
76 Bool NaClInstValidates(uint8_t* mbase,
77 uint8_t size,
78 NaClPcAddress vbase,
79 NaClInstStruct *inst);
80
81 /* Runs the validator on the instruction sequence in the given code segment,
82 * and returns true if it validates. Assumes that the supporting architecture
83 * supports all known x86 architectures.
84 *
85 * Parameters are:
86 * mbase - The memory containing the bytes of the instruction to decode.
87 * size - The number of bytes defining the instruction.
88 * vbase - The virtual address associated with the instruction.
89 */
90 Bool NaClSegmentValidates(uint8_t* mbase,
91 size_t size,
92 NaClPcAddress vbase);
93
94 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCEMNUMINSTS_H_ */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698