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; | |
21 using nacl_mips_dec::RegisterList; | 20 using nacl_mips_dec::RegisterList; |
22 using nacl_mips_dec::kRegisterStack; | |
23 using nacl_mips_dec::kRegListReserved; | |
24 using std::vector; | 21 using std::vector; |
25 | 22 |
26 | 23 |
27 class EarlyExitProblemSink : public nacl_mips_val::ProblemSink { | 24 class EarlyExitProblemSink : public nacl_mips_val::ProblemSink { |
28 private: | 25 private: |
29 bool problems_; | 26 bool problems_; |
30 | 27 |
31 public: | 28 public: |
32 EarlyExitProblemSink() : nacl_mips_val::ProblemSink(), problems_(false) {} | 29 EarlyExitProblemSink() : nacl_mips_val::ProblemSink(), problems_(false) {} |
33 | 30 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 80 |
84 EXTERN_C_BEGIN | 81 EXTERN_C_BEGIN |
85 | 82 |
86 int NCValidateSegment(uint8_t *mbase, uint32_t vbase, size_t size, | 83 int NCValidateSegment(uint8_t *mbase, uint32_t vbase, size_t size, |
87 bool stubout_mode) { | 84 bool stubout_mode) { |
88 SfiValidator validator( | 85 SfiValidator validator( |
89 16, // 64, // bytes per bundle | 86 16, // 64, // bytes per bundle |
90 1U * NACL_DATA_SEGMENT_START, // bytes of code space | 87 1U * NACL_DATA_SEGMENT_START, // bytes of code space |
91 1U * (1 << NACL_MAX_ADDR_BITS), // bytes of data space // keep in sync w/ | 88 1U * (1 << NACL_MAX_ADDR_BITS), // bytes of data space // keep in sync w/ |
92 // SConstruct: irt_compatible_rodata_addr | 89 // SConstruct: irt_compatible_rodata_addr |
93 kRegListReserved, // read only register(s) | 90 RegisterList::ReservedRegs(), // read only register(s) |
94 RegisterList(kRegisterStack)); // data addressing register(s) | 91 RegisterList::DataAddrRegs()); // data addressing register(s) |
95 bool success = false; | 92 bool success = false; |
96 | 93 |
97 vector<CodeSegment> segments; | 94 vector<CodeSegment> segments; |
98 segments.push_back(CodeSegment(mbase, vbase, size)); | 95 segments.push_back(CodeSegment(mbase, vbase, size)); |
99 | 96 |
100 if (stubout_mode) { | 97 if (stubout_mode) { |
101 StuboutProblemSink sink; | 98 StuboutProblemSink sink; |
102 success = validator.Validate(segments, &sink); | 99 success = validator.Validate(segments, &sink); |
103 } else { | 100 } else { |
104 EarlyExitProblemSink sink; | 101 EarlyExitProblemSink sink; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 */ | 179 */ |
183 int NaClCopyInstruction(uint8_t *dst, uint8_t *src, uint8_t sz) { | 180 int NaClCopyInstruction(uint8_t *dst, uint8_t *src, uint8_t sz) { |
184 UNREFERENCED_PARAMETER(dst); | 181 UNREFERENCED_PARAMETER(dst); |
185 UNREFERENCED_PARAMETER(src); | 182 UNREFERENCED_PARAMETER(src); |
186 UNREFERENCED_PARAMETER(sz); | 183 UNREFERENCED_PARAMETER(sz); |
187 | 184 |
188 return 0; | 185 return 0; |
189 } | 186 } |
190 | 187 |
191 EXTERN_C_END | 188 EXTERN_C_END |
OLD | NEW |