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

Unified Diff: src/trusted/validator_mips/validator.cc

Issue 11090024: [MIPS] New pattern in validator to detect jumps/branches in delay slots. (Closed) Base URL: http://git.chromium.org/native_client/src/native_client.git@master
Patch Set: Two more test cases added. Created 8 years, 2 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
« no previous file with comments | « src/trusted/validator_mips/validator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/trusted/validator_mips/validator.cc
diff --git a/src/trusted/validator_mips/validator.cc b/src/trusted/validator_mips/validator.cc
index eff0dad37e0a52ac4f967baf8abea38a3240f687..1e4d71e651258106447f6e1013b11454983db0dd 100644
--- a/src/trusted/validator_mips/validator.cc
+++ b/src/trusted/validator_mips/validator.cc
@@ -215,6 +215,23 @@ static PatternMatch CheckLoadStore(const SfiValidator &sfi,
}
+/*
+ * Checks if there is jump/branch in the delay slot.
+ */
+static PatternMatch CheckBranchInDelaySlot(const SfiValidator &sfi,
+ const DecodedInstruction &first,
+ const DecodedInstruction &second,
+ ProblemSink *out) {
+ UNREFERENCED_PARAMETER(sfi);
+ if (first.HasDelaySlot() && second.HasDelaySlot()) {
+ out->ReportProblem(second.addr(), second.safety(),
+ kProblemBranchInDelaySlot);
+ return PATTERN_UNSAFE;
+ }
+ return NO_MATCH;
+}
+
+
/*********************************************************
* Pseudo-instruction patterns.
*********************************************************/
@@ -418,7 +435,8 @@ bool SfiValidator::ApplyPatterns(const DecodedInstruction &first,
&CheckJmpReg,
&CheckDataRegisterUpdate,
&CheckDataRegisterDslot,
- &CheckLoadStore
+ &CheckLoadStore,
+ &CheckBranchInDelaySlot
};
bool complete_success = true;
« no previous file with comments | « src/trusted/validator_mips/validator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698