| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 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 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 "native_client/src/trusted/validator/x86/ncval_reg_sfi/ncvalidator_regi
stry.h" | 7 #include "native_client/src/trusted/validator/x86/ncval_reg_sfi/ncvalidator_regi
stry.h" |
| 8 | 8 |
| 9 #include "native_client/src/shared/platform/nacl_log.h" | 9 #include "native_client/src/shared/platform/nacl_log.h" |
| 10 #include "native_client/src/trusted/validator/x86/decoder/nc_inst_iter.h" | |
| 11 #include "native_client/src/trusted/validator/x86/decoder/nc_inst_state.h" | 10 #include "native_client/src/trusted/validator/x86/decoder/nc_inst_state.h" |
| 12 #include "native_client/src/trusted/validator/x86/decoder/ncop_exps.h" | 11 #include "native_client/src/trusted/validator/x86/decoder/ncop_exps.h" |
| 13 #include "native_client/src/trusted/validator/x86/ncval_reg_sfi/ncvalidate_iter.
h" | 12 #include "native_client/src/trusted/validator/x86/ncval_reg_sfi/ncvalidate_iter.
h" |
| 14 #include "native_client/src/trusted/validator/x86/ncval_reg_sfi/ncvalidate_iter_
internal.h" | 13 #include "native_client/src/trusted/validator/x86/ncval_reg_sfi/ncvalidate_iter_
internal.h" |
| 15 #include "native_client/src/trusted/validator/x86/ncval_reg_sfi/nc_jumps.h" | 14 #include "native_client/src/trusted/validator/x86/ncval_reg_sfi/nc_jumps.h" |
| 16 #include "native_client/src/trusted/validator/x86/ncval_reg_sfi/nc_cpu_checks.h" | 15 #include "native_client/src/trusted/validator/x86/ncval_reg_sfi/nc_cpu_checks.h" |
| 17 #include "native_client/src/trusted/validator/x86/ncval_reg_sfi/nc_illegal.h" | 16 #include "native_client/src/trusted/validator/x86/ncval_reg_sfi/nc_illegal.h" |
| 18 #include "native_client/src/trusted/validator/x86/ncval_reg_sfi/nc_jumps.h" | 17 #include "native_client/src/trusted/validator/x86/ncval_reg_sfi/nc_jumps.h" |
| 19 #include "native_client/src/trusted/validator/x86/ncval_reg_sfi/nc_opcode_histog
ram.h" | 18 #include "native_client/src/trusted/validator/x86/ncval_reg_sfi/nc_opcode_histog
ram.h" |
| 20 #include "native_client/src/trusted/validator/x86/ncval_reg_sfi/nc_memory_protec
t.h" | 19 #include "native_client/src/trusted/validator/x86/ncval_reg_sfi/nc_memory_protec
t.h" |
| 21 #include "native_client/src/trusted/validator/x86/ncval_reg_sfi/nc_protect_base.
h" | 20 #include "native_client/src/trusted/validator/x86/ncval_reg_sfi/nc_protect_base.
h" |
| 22 | 21 |
| 22 #include "native_client/src/trusted/validator/x86/decoder/nc_inst_iter_inl.c" |
| 23 |
| 23 Bool NACL_FLAGS_opcode_histogram = FALSE; | 24 Bool NACL_FLAGS_opcode_histogram = FALSE; |
| 24 | 25 |
| 25 static void NaClValidatorTrace(NaClValidatorState* state, | 26 static void NaClValidatorTrace(NaClValidatorState* state, |
| 26 NaClInstIter* iter, | 27 NaClInstIter* iter, |
| 27 void* local_memory) { | 28 void* local_memory) { |
| 28 struct Gio* g = NaClLogGetGio(); | 29 struct Gio* g = NaClLogGetGio(); |
| 29 NaClInstState* inst_state = NaClInstIterGetState(iter); | 30 NaClInstState* inst_state = NaClInstIterGetStateInline(iter); |
| 30 if (NaClValidatorStateTrace(state)) { | 31 if (NaClValidatorStateTrace(state)) { |
| 31 gprintf(g, "-> visit: "); | 32 gprintf(g, "-> visit: "); |
| 32 } | 33 } |
| 33 if (NaClValidatorStateGetTraceInstructions(state)) { | 34 if (NaClValidatorStateGetTraceInstructions(state)) { |
| 34 (*state->error_reporter->print_inst)(state->error_reporter, | 35 (*state->error_reporter->print_inst)(state->error_reporter, |
| 35 (void*) NaClInstStateInst(inst_state)); | 36 (void*) NaClInstStateInst(inst_state)); |
| 36 } | 37 } |
| 37 if (NaClValidatorStateGetTraceInstInternals(state)) { | 38 if (NaClValidatorStateGetTraceInstInternals(state)) { |
| 38 NaClExpVectorPrint(g, NaClInstStateExpVector(inst_state)); | 39 NaClExpVectorPrint(g, NaClInstStateExpVector(inst_state)); |
| 39 } | 40 } |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 if (state->print_opcode_histogram) { | 108 if (state->print_opcode_histogram) { |
| 108 NaClRegisterValidator( | 109 NaClRegisterValidator( |
| 109 state, | 110 state, |
| 110 (NaClValidator) NaClOpcodeHistogramRecord, | 111 (NaClValidator) NaClOpcodeHistogramRecord, |
| 111 (NaClValidatorPostValidate) NULL, | 112 (NaClValidatorPostValidate) NULL, |
| 112 (NaClValidatorPrintStats) NaClOpcodeHistogramPrintStats, | 113 (NaClValidatorPrintStats) NaClOpcodeHistogramPrintStats, |
| 113 (NaClValidatorMemoryCreate) NaClOpcodeHistogramMemoryCreate, | 114 (NaClValidatorMemoryCreate) NaClOpcodeHistogramMemoryCreate, |
| 114 (NaClValidatorMemoryDestroy) NaClOpcodeHistogramMemoryDestroy); | 115 (NaClValidatorMemoryDestroy) NaClOpcodeHistogramMemoryDestroy); |
| 115 } | 116 } |
| 116 } | 117 } |
| OLD | NEW |