| 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_details.c | 8 * ncvalidate_details.c |
| 9 * Attach detailed error reporter to the NaCl validator. Does a second | 9 * Attach detailed error reporter to the NaCl validator. Does a second |
| 10 * walk of the instructions to find instructions that explicitly branch | 10 * walk of the instructions to find instructions that explicitly branch |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 dstate->new_segment_fn = (NCDecoderStateMethod) NCNullDecoderStateMethod; | 146 dstate->new_segment_fn = (NCDecoderStateMethod) NCNullDecoderStateMethod; |
| 147 dstate->internal_error_fn = (NCDecoderStateMethod) NCNullDecoderStateMethod; | 147 dstate->internal_error_fn = (NCDecoderStateMethod) NCNullDecoderStateMethod; |
| 148 dstate->internal_error_fn = (NCDecoderStateMethod) NCStatsInternalError; | 148 dstate->internal_error_fn = (NCDecoderStateMethod) NCStatsInternalError; |
| 149 NCDecoderStateSetErrorReporter(dstate, reporter); | 149 NCDecoderStateSetErrorReporter(dstate, reporter); |
| 150 NCDecoderStateDecode(dstate); | 150 NCDecoderStateDecode(dstate); |
| 151 } | 151 } |
| 152 | 152 |
| 153 struct NCValidatorState *NCValidateInitDetailed( | 153 struct NCValidatorState *NCValidateInitDetailed( |
| 154 const NaClPcAddress vbase, | 154 const NaClPcAddress vbase, |
| 155 const NaClMemorySize codesize, | 155 const NaClMemorySize codesize, |
| 156 const uint8_t alignment, | |
| 157 const NaClCPUFeaturesX86* features) { | 156 const NaClCPUFeaturesX86* features) { |
| 158 struct NCValidatorState *vstate = NCValidateInit(vbase, codesize, alignment, | 157 struct NCValidatorState *vstate = NCValidateInit(vbase, codesize, |
| 159 FALSE, features); | 158 FALSE, features); |
| 160 if (NULL != vstate) { | 159 if (NULL != vstate) { |
| 161 vstate->summarize_fn = NCJumpSummarizeDetailed; | 160 vstate->summarize_fn = NCJumpSummarizeDetailed; |
| 162 vstate->pattern_nonfirst_insts_table = | 161 vstate->pattern_nonfirst_insts_table = |
| 163 (uint8_t *)calloc(NCIATOffset(codesize) + 1, 1); | 162 (uint8_t *)calloc(NCIATOffset(codesize) + 1, 1); |
| 164 if (NULL == vstate->pattern_nonfirst_insts_table) { | 163 if (NULL == vstate->pattern_nonfirst_insts_table) { |
| 165 if (NULL != vstate->kttable) free(vstate->kttable); | 164 if (NULL != vstate->kttable) free(vstate->kttable); |
| 166 if (NULL != vstate->vttable) free(vstate->vttable); | 165 if (NULL != vstate->vttable) free(vstate->vttable); |
| 167 free(vstate); | 166 free(vstate); |
| 168 return NULL; | 167 return NULL; |
| 169 } | 168 } |
| 170 } | 169 } |
| 171 return vstate; | 170 return vstate; |
| 172 } | 171 } |
| OLD | NEW |