Chromium Code Reviews| Index: src/trusted/validator_arm/ncval.cc |
| diff --git a/src/trusted/validator_arm/ncval.cc b/src/trusted/validator_arm/ncval.cc |
| index cdf2f8dc6e8582bae6639ec312b5d12abaa31b70..8bb0bb779250602aa92cafe821c107921fd4afae 100644 |
| --- a/src/trusted/validator_arm/ncval.cc |
| +++ b/src/trusted/validator_arm/ncval.cc |
| @@ -51,18 +51,23 @@ class CommandLineProblemSink : public nacl_arm_val::ProblemSink { |
| const uint32_t kOneGig = 1U * 1024 * 1024 * 1024; |
| -int validate(const ncfile *ncf, bool use_zero_masks) { |
| +int validate(const ncfile *ncf, bool use_zero_masks, bool thumb) { |
|
Karl
2011/09/19 19:56:05
Should this be static?
bsy
2011/09/21 22:32:17
since this is C++ code, put this in a namespace?
jasonwkim
2011/09/26 21:35:52
since this code is already only called by main, pr
jasonwkim
2011/09/26 21:35:52
only called by main - I think its fine
|
| + nacl_arm_dec::RegisterList roRegs = nacl_arm_dec::Register(9); |
| + if (thumb) { |
|
Karl
2011/09/19 19:56:05
Thumb2?
jasonwkim
2011/09/26 21:35:52
again thumb mode
|
| + roRegs = nacl_arm_dec::kRegisterListNothing; |
| + } |
| SfiValidator validator( |
| 16, // bytes per bundle |
| // TODO(cbiffle): maybe check region sizes from ELF headers? |
| // verify that instructions are in right region |
| kOneGig, // code region size |
| kOneGig, // data region size |
| - nacl_arm_dec::Register(9), // read only register (used for threading) |
| - nacl_arm_dec::Register(13)); // stack pointer |
| + roRegs, // read only register (used for threading) |
| + nacl_arm_dec::Register(13), // stack pointer |
| + thumb); |
| if (use_zero_masks) { |
| - validator.change_masks(0, 0); |
| + validator.change_masks(0, 0, 0); |
| } |
| CommandLineProblemSink sink; |
| @@ -74,7 +79,8 @@ int validate(const ncfile *ncf, bool use_zero_masks) { |
| if ((shdr[i].sh_flags & SHF_EXECINSTR) != SHF_EXECINSTR) { |
| continue; |
| } |
| - |
| + fprintf(stderr, "CodeSegment(%x, %x, %x)\n", (unsigned int)(ncf->data + (shdr[i].sh_addr - ncf->vbase)), |
|
Karl
2011/09/19 19:56:05
Should this have a DEBUG prefix like line 126?
jasonwkim
2011/09/26 21:35:52
debug printfs killed
|
| + shdr[i].sh_addr, shdr[i].sh_size); |
| CodeSegment segment(ncf->data + (shdr[i].sh_addr - ncf->vbase), |
| shdr[i].sh_addr, shdr[i].sh_size); |
| segments.push_back(segment); |
| @@ -117,8 +123,9 @@ int main(int argc, const char *argv[]) { |
| } |
| // TODO(cbiffle): check OS ABI, ABI version, align mask |
| + fprintf(stderr, "mrm DEBUG: Entry: %x\n", ncf->eheader->e_entry); |
| + int exit_code = validate(ncf, use_zero_masks, ncf->eheader->e_entry & 1); |
| - int exit_code = validate(ncf, use_zero_masks); |
| nc_freefile(ncf); |
| return exit_code; |
| } |