Chromium Code Reviews| 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/cpu_features/arch/mips/cpu_mips.h" | 14 #include "native_client/src/trusted/cpu_features/arch/mips/cpu_mips.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_mips/validator.h" | 16 #include "native_client/src/trusted/validator_mips/validator.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::kRegListDataAddr; |
|
Mark Seaborn
2013/01/15 16:51:36
Wouldn't it be better to use the fully-qualified n
| |
| 21 using nacl_mips_dec::RegisterList; | |
| 22 using nacl_mips_dec::kRegisterStack; | |
| 23 using nacl_mips_dec::kRegListReserved; | 21 using nacl_mips_dec::kRegListReserved; |
| 24 using std::vector; | 22 using std::vector; |
| 25 | 23 |
| 26 | 24 |
| 27 class EarlyExitProblemSink : public nacl_mips_val::ProblemSink { | 25 class EarlyExitProblemSink : public nacl_mips_val::ProblemSink { |
| 28 private: | 26 private: |
| 29 bool problems_; | 27 bool problems_; |
| 30 | 28 |
| 31 public: | 29 public: |
| 32 EarlyExitProblemSink() : nacl_mips_val::ProblemSink(), problems_(false) {} | 30 EarlyExitProblemSink() : nacl_mips_val::ProblemSink(), problems_(false) {} |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 } | 79 } |
| 82 }; | 80 }; |
| 83 | 81 |
| 84 EXTERN_C_BEGIN | 82 EXTERN_C_BEGIN |
| 85 | 83 |
| 86 int NCValidateSegment(uint8_t *mbase, uint32_t vbase, size_t size, | 84 int NCValidateSegment(uint8_t *mbase, uint32_t vbase, size_t size, |
| 87 bool stubout_mode) { | 85 bool stubout_mode) { |
| 88 SfiValidator validator( | 86 SfiValidator validator( |
| 89 16, // 64, // bytes per bundle | 87 16, // 64, // bytes per bundle |
| 90 1U * NACL_DATA_SEGMENT_START, // bytes of code space | 88 1U * NACL_DATA_SEGMENT_START, // bytes of code space |
| 91 1U * (1 << NACL_MAX_ADDR_BITS), // bytes of data space // keep in sync w/ | 89 1U * (1 << NACL_MAX_ADDR_BITS), // bytes of data space // keep in sync w/ |
|
Mark Seaborn
2013/01/15 16:51:36
Hmm, as an aside, this code is duplicated between
JF
2013/01/15 17:03:03
This code should stay, and ncval.cc should be dele
petarj
2013/01/22 22:57:30
I will clean it up in a separate change.
So we do
| |
| 92 // SConstruct: irt_compatible_rodata_addr | 90 // SConstruct: irt_compatible_rodata_addr |
| 93 kRegListReserved, // read only register(s) | 91 kRegListReserved, // read only register(s) |
| 94 RegisterList(kRegisterStack)); // data addressing register(s) | 92 kRegListDataAddr); // data addressing register(s) |
| 95 bool success = false; | 93 bool success = false; |
| 96 | 94 |
| 97 vector<CodeSegment> segments; | 95 vector<CodeSegment> segments; |
| 98 segments.push_back(CodeSegment(mbase, vbase, size)); | 96 segments.push_back(CodeSegment(mbase, vbase, size)); |
| 99 | 97 |
| 100 if (stubout_mode) { | 98 if (stubout_mode) { |
| 101 StuboutProblemSink sink; | 99 StuboutProblemSink sink; |
| 102 success = validator.Validate(segments, &sink); | 100 success = validator.Validate(segments, &sink); |
| 103 } else { | 101 } else { |
| 104 EarlyExitProblemSink sink; | 102 EarlyExitProblemSink sink; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 182 */ | 180 */ |
| 183 int NaClCopyInstruction(uint8_t *dst, uint8_t *src, uint8_t sz) { | 181 int NaClCopyInstruction(uint8_t *dst, uint8_t *src, uint8_t sz) { |
| 184 UNREFERENCED_PARAMETER(dst); | 182 UNREFERENCED_PARAMETER(dst); |
| 185 UNREFERENCED_PARAMETER(src); | 183 UNREFERENCED_PARAMETER(src); |
| 186 UNREFERENCED_PARAMETER(sz); | 184 UNREFERENCED_PARAMETER(sz); |
| 187 | 185 |
| 188 return 0; | 186 return 0; |
| 189 } | 187 } |
| 190 | 188 |
| 191 EXTERN_C_END | 189 EXTERN_C_END |
| OLD | NEW |