OLD | NEW |
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 * ncvalidate.c | 8 * ncvalidate.c |
9 * Validate x86 instructions for Native Client | 9 * Validate x86 instructions for Native Client |
10 * | 10 * |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 static int kMaxDiagnostics = 0; | 71 static int kMaxDiagnostics = 0; |
72 | 72 |
73 int NCValidatorGetMaxDiagnostics() { | 73 int NCValidatorGetMaxDiagnostics() { |
74 return kMaxDiagnostics; | 74 return kMaxDiagnostics; |
75 } | 75 } |
76 | 76 |
77 void NCValidatorSetMaxDiagnostics(int new_value) { | 77 void NCValidatorSetMaxDiagnostics(int new_value) { |
78 kMaxDiagnostics = new_value; | 78 kMaxDiagnostics = new_value; |
79 } | 79 } |
80 | 80 |
| 81 int NCValidatorDidStubOut(struct NCValidatorState *vstate) { |
| 82 return vstate->stats.didstubout; |
| 83 } |
| 84 |
81 /* This function is intended to only be called by ValidatePrintInstructionError | 85 /* This function is intended to only be called by ValidatePrintInstructionError |
82 * and ValidatePrintOffsetError. | 86 * and ValidatePrintOffsetError. |
83 */ | 87 */ |
84 static void ValidatePrintError(const NaClPcAddress addr, | 88 static void ValidatePrintError(const NaClPcAddress addr, |
85 const char *msg, | 89 const char *msg, |
86 struct NCValidatorState *vstate) { | 90 struct NCValidatorState *vstate) { |
87 if (vstate->num_diagnostics != 0) { | 91 if (vstate->num_diagnostics != 0) { |
88 NaClErrorReporter* reporter = vstate->dstate.error_reporter; | 92 NaClErrorReporter* reporter = vstate->dstate.error_reporter; |
89 (*reporter->printf)( | 93 (*reporter->printf)( |
90 reporter, | 94 reporter, |
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1052 } | 1056 } |
1053 | 1057 |
1054 /* check basic block boundaries */ | 1058 /* check basic block boundaries */ |
1055 for (offset = 0; offset < vstate->codesize; offset += vstate->alignment) { | 1059 for (offset = 0; offset < vstate->codesize; offset += vstate->alignment) { |
1056 if (!NCGetAdrTable(offset, vstate->vttable)) { | 1060 if (!NCGetAdrTable(offset, vstate->vttable)) { |
1057 ValidatePrintOffsetError(offset, "Bad basic block alignment", vstate); | 1061 ValidatePrintOffsetError(offset, "Bad basic block alignment", vstate); |
1058 NCStatsBadAlignment(vstate); | 1062 NCStatsBadAlignment(vstate); |
1059 } | 1063 } |
1060 } | 1064 } |
1061 } | 1065 } |
OLD | NEW |