| 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 #include "native_client/src/trusted/validator_mips/ncvalidate.h" | 7 #include "native_client/src/trusted/validator_mips/ncvalidate.h" |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "native_client/src/include/nacl_string.h" | 11 #include "native_client/src/include/nacl_string.h" |
| 12 #include "native_client/src/include/portability.h" | 12 #include "native_client/src/include/portability.h" |
| 13 #include "native_client/src/trusted/service_runtime/arch/mips/sel_ldr_mips.h" | 13 #include "native_client/src/trusted/service_runtime/arch/mips/sel_ldr_mips.h" |
| 14 #include "native_client/src/trusted/validator_mips/validator.h" | 14 #include "native_client/src/trusted/validator_mips/validator.h" |
| 15 #include "native_client/src/trusted/validator_mips/model.h" | 15 #include "native_client/src/trusted/validator_mips/model.h" |
| 16 #include "native_client/src/trusted/validator/ncvalidate.h" | 16 #include "native_client/src/trusted/validator/ncvalidate.h" |
| 17 | 17 |
| 18 using nacl_mips_val::SfiValidator; | 18 using nacl_mips_val::SfiValidator; |
| 19 using nacl_mips_val::CodeSegment; | 19 using nacl_mips_val::CodeSegment; |
| 20 using nacl_mips_dec::Register; | 20 using nacl_mips_dec::Register; |
| 21 using nacl_mips_dec::RegisterList; |
| 21 using nacl_mips_dec::kRegisterStack; | 22 using nacl_mips_dec::kRegisterStack; |
| 22 using nacl_mips_dec::kRegListReserved; | 23 using nacl_mips_dec::kRegListReserved; |
| 23 using std::vector; | 24 using std::vector; |
| 24 | 25 |
| 25 | 26 |
| 26 class EarlyExitProblemSink : public nacl_mips_val::ProblemSink { | 27 class EarlyExitProblemSink : public nacl_mips_val::ProblemSink { |
| 27 private: | 28 private: |
| 28 bool problems_; | 29 bool problems_; |
| 29 | 30 |
| 30 public: | 31 public: |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 #endif | 79 #endif |
| 79 *reinterpret_cast<uint32_t *>(vaddr) = kNaClFullStop; | 80 *reinterpret_cast<uint32_t *>(vaddr) = kNaClFullStop; |
| 80 } | 81 } |
| 81 }; | 82 }; |
| 82 | 83 |
| 83 EXTERN_C_BEGIN | 84 EXTERN_C_BEGIN |
| 84 | 85 |
| 85 int NCValidateSegment(uint8_t *mbase, uint32_t vbase, size_t size, | 86 int NCValidateSegment(uint8_t *mbase, uint32_t vbase, size_t size, |
| 86 bool stubout_mode) { | 87 bool stubout_mode) { |
| 87 SfiValidator validator( | 88 SfiValidator validator( |
| 88 16, // 64, // bytes per bundle | 89 16, // 64, // bytes per bundle |
| 89 1U * NACL_DATA_SEGMENT_START, // bytes of code space | 90 1U * NACL_DATA_SEGMENT_START, // bytes of code space |
| 90 1U * (1<<NACL_MAX_ADDR_BITS), // bytes of data space // keep in sync w/ | 91 1U * (1<<NACL_MAX_ADDR_BITS), // bytes of data space // keep in sync w/ |
| 91 // SConstruct: irt_compatible_rodata_addr | 92 // SConstruct: irt_compatible_rodata_addr |
| 92 kRegListReserved, // read only register(s) | 93 kRegListReserved, // read only register(s) |
| 93 kRegisterStack); // data addressing register(s) | 94 RegisterList(kRegisterStack)); // data addressing register(s) |
| 94 bool success = false; | 95 bool success = false; |
| 95 | 96 |
| 96 vector<CodeSegment> segments; | 97 vector<CodeSegment> segments; |
| 97 segments.push_back(CodeSegment(mbase, vbase, size)); | 98 segments.push_back(CodeSegment(mbase, vbase, size)); |
| 98 | 99 |
| 99 if (stubout_mode) { | 100 if (stubout_mode) { |
| 100 StuboutProblemSink sink; | 101 StuboutProblemSink sink; |
| 101 success = validator.Validate(segments, &sink); | 102 success = validator.Validate(segments, &sink); |
| 102 } else { | 103 } else { |
| 103 EarlyExitProblemSink sink; | 104 EarlyExitProblemSink sink; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 */ | 178 */ |
| 178 int NaClCopyInstruction(uint8_t *dst, uint8_t *src, uint8_t sz) { | 179 int NaClCopyInstruction(uint8_t *dst, uint8_t *src, uint8_t sz) { |
| 179 UNREFERENCED_PARAMETER(dst); | 180 UNREFERENCED_PARAMETER(dst); |
| 180 UNREFERENCED_PARAMETER(src); | 181 UNREFERENCED_PARAMETER(src); |
| 181 UNREFERENCED_PARAMETER(sz); | 182 UNREFERENCED_PARAMETER(sz); |
| 182 | 183 |
| 183 return 0; | 184 return 0; |
| 184 } | 185 } |
| 185 | 186 |
| 186 EXTERN_C_END | 187 EXTERN_C_END |
| OLD | NEW |