| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2009 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * be found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 /* | 7 /* |
| 8 * Defines an instruction (decoder) iterator that processes code segments. | 8 * Defines an instruction (decoder) iterator that processes code segments. |
| 9 * | 9 * |
| 10 * The typical use is of the form: | 10 * The typical use is of the form: |
| 11 * | 11 * |
| 12 * NaClSegment segment; | 12 * NaClSegment segment; |
| 13 * NaClInstIter* iter; | 13 * NaClInstIter* iter; |
| 14 * ... | 14 * ... |
| 15 * for (iter = NaClInstIterCreate(&segment); NaClInstIterHasNext(iter); | 15 * for (iter = NaClInstIterCreate(&segment); NaClInstIterHasNext(iter); |
| 16 * NaClInstIterAdvance(iter)) { | 16 * NaClInstIterAdvance(iter)) { |
| 17 * NaClInstState* state = NaClInstIterGetState(iter); | 17 * NaClInstState* state = NaClInstIterGetState(iter); |
| 18 * ... | 18 * ... |
| 19 * } | 19 * } |
| 20 * NaClInstIterDestroy(iter); | 20 * NaClInstIterDestroy(iter); |
| 21 */ | 21 */ |
| 22 | 22 |
| 23 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NC_INST_ITER_h_ | 23 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NC_INST_ITER_h_ |
| 24 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NC_INST_ITER_h_ | 24 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NC_INST_ITER_h_ |
| 25 | 25 |
| 26 #include "native_client/src/trusted/validator_x86/ncopcode_desc.h" | 26 #include "native_client/src/trusted/validator_x86/ncopcode_desc.h" |
| 27 #include "native_client/src/shared/utils/types.h" | 27 #include "native_client/src/shared/utils/types.h" |
| 28 | 28 |
| 29 EXTERN_C_BEGIN |
| 30 |
| 29 /* Defines a code segment in the elf file. */ | 31 /* Defines a code segment in the elf file. */ |
| 30 struct NaClSegment; | 32 struct NaClSegment; |
| 31 | 33 |
| 32 /* Defines the internal state associated with a parsed instruction.*/ | 34 /* Defines the internal state associated with a parsed instruction.*/ |
| 33 struct NaClInstState; | 35 struct NaClInstState; |
| 34 | 36 |
| 35 /* Defines the structure of an instruction iterator, which walks | 37 /* Defines the structure of an instruction iterator, which walks |
| 36 * the code segment, one instruction at a time. | 38 * the code segment, one instruction at a time. |
| 37 */ | 39 */ |
| 38 typedef struct NaClInstIter NaClInstIter; | 40 typedef struct NaClInstIter NaClInstIter; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 NaClInstIter* iter, size_t distance); | 79 NaClInstIter* iter, size_t distance); |
| 78 | 80 |
| 79 /* Advance the iterator past the current instruction. */ | 81 /* Advance the iterator past the current instruction. */ |
| 80 void NaClInstIterAdvance(NaClInstIter* iter); | 82 void NaClInstIterAdvance(NaClInstIter* iter); |
| 81 | 83 |
| 82 /* Returns the memory address of the beginning of the currently | 84 /* Returns the memory address of the beginning of the currently |
| 83 * matched instruction. | 85 * matched instruction. |
| 84 */ | 86 */ |
| 85 uint8_t* NaClInstIterGetInstMemory(NaClInstIter* iter); | 87 uint8_t* NaClInstIterGetInstMemory(NaClInstIter* iter); |
| 86 | 88 |
| 89 EXTERN_C_END |
| 90 |
| 87 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NC_INST_ITER_h_ */ | 91 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NC_INST_ITER_h_ */ |
| OLD | NEW |