Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Unified Diff: src/trusted/validator_arm/ncval.cc

Issue 7799013: Intial Thumb2 Sandbox (naclrev 6680) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: fix comma Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
}

Powered by Google App Engine
This is Rietveld 408576698