| 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 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 | 1003 |
| 1004 old_vstate = NCValidateInit(vbase, sz, FALSE, features); | 1004 old_vstate = NCValidateInit(vbase, sz, FALSE, features); |
| 1005 if (old_vstate != NULL) { | 1005 if (old_vstate != NULL) { |
| 1006 NCValidateDStateInit(old_vstate, mbase_old, vbase, sz); | 1006 NCValidateDStateInit(old_vstate, mbase_old, vbase, sz); |
| 1007 new_vstate = NCValidateInit(vbase, sz, FALSE, features); | 1007 new_vstate = NCValidateInit(vbase, sz, FALSE, features); |
| 1008 if (new_vstate != NULL) { | 1008 if (new_vstate != NULL) { |
| 1009 NCValidateDStateInit(new_vstate, mbase_new, vbase, sz); | 1009 NCValidateDStateInit(new_vstate, mbase_new, vbase, sz); |
| 1010 | 1010 |
| 1011 NCDecoderStatePairConstruct(&pair, | 1011 NCDecoderStatePairConstruct(&pair, |
| 1012 &old_vstate->dstate, | 1012 &old_vstate->dstate, |
| 1013 &new_vstate->dstate); | 1013 &new_vstate->dstate, |
| 1014 NULL); /* copy_func */ |
| 1014 pair.action_fn = ValidateInstReplacement; | 1015 pair.action_fn = ValidateInstReplacement; |
| 1015 if (NCDecoderStatePairDecode(&pair)) { | 1016 if (NCDecoderStatePairDecode(&pair)) { |
| 1016 result = 1; | 1017 result = 1; |
| 1017 } else { | 1018 } else { |
| 1018 ValidatePrintOffsetError(0, "Replacement not applied!\n", new_vstate); | 1019 ValidatePrintOffsetError(0, "Replacement not applied!\n", new_vstate); |
| 1019 } | 1020 } |
| 1020 if (NCValidateFinish(new_vstate)) { | 1021 if (NCValidateFinish(new_vstate)) { |
| 1021 /* Errors occurred during validation. */ | 1022 /* Errors occurred during validation. */ |
| 1022 result = 0; | 1023 result = 0; |
| 1023 } | 1024 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1053 } | 1054 } |
| 1054 | 1055 |
| 1055 /* check basic block boundaries */ | 1056 /* check basic block boundaries */ |
| 1056 for (offset = 0; offset < vstate->codesize; offset += vstate->bundle_size) { | 1057 for (offset = 0; offset < vstate->codesize; offset += vstate->bundle_size) { |
| 1057 if (!NCGetAdrTable(offset, vstate->vttable)) { | 1058 if (!NCGetAdrTable(offset, vstate->vttable)) { |
| 1058 ValidatePrintOffsetError(offset, "Bad basic block alignment", vstate); | 1059 ValidatePrintOffsetError(offset, "Bad basic block alignment", vstate); |
| 1059 NCStatsBadAlignment(vstate); | 1060 NCStatsBadAlignment(vstate); |
| 1060 } | 1061 } |
| 1061 } | 1062 } |
| 1062 } | 1063 } |
| OLD | NEW |