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

Unified Diff: src/trusted/validator_arm/dgen_input.py

Issue 10949006: Change table data_processing_immediate to use the new notation. Also (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: Created 8 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/dgen_input.py
===================================================================
--- src/trusted/validator_arm/dgen_input.py (revision 9758)
+++ src/trusted/validator_arm/dgen_input.py (working copy)
@@ -20,7 +20,7 @@
action_safety |
action_arch |
action_other) ';'
-action_options_deprecated ::= (id (word (rule_restrict id?)?)?)?
+action_options_deprecated ::= (id (word (rule_restrict_deprecated id?)?)?)?
action_other ::= word ':=' bit_expr
action_pattern ::= 'pattern' ':=' word rule_restrict?
action_safety ::= 'safety' ':=' safety_check ('&' safety_check)*
@@ -65,7 +65,8 @@
pat_row ::= pattern+ action
pattern ::= bitpattern | '-' | '"'
row ::= '|' (pat_row | default_row)
-rule_restrict ::= ('&' bitpattern)* ('&' 'other' ':' id)?
+rule_restrict ::= ('&' bit_expr)* ('&' 'other' ':' id)?
+rule_restrict_deprecated ::= ('&' bitpattern)* ('&' 'other' ':' id)?
safety_check ::= id | bit_expr1 ('=>' id)? # note: single id only at end.
table ::= table_desc table_actions header row+ footer
table_actions ::= ( ('*' int decoder fields? action_options*)+ footer)?
@@ -530,7 +531,7 @@
else:
context.define('rule', self._read_id_or_none(True))
context.define('pattern', self._read_id_or_none(False))
- self._rule_restrict(context)
+ self._rule_restrict_deprecated(context)
other_restrictions = self._read_id_or_none(True)
if other_restrictions:
context.define('safety', [other_restrictions])
@@ -711,6 +712,22 @@
return self._pat_row(table, starred_actions, last_patterns, last_action)
def _rule_restrict(self, context):
+ """ rule_restrict ::= ('&' bit_expr)* ('&' 'other' ':' id)? """
+
+ restrictions = context.find('constraints')
+ if not restrictions:
+ context.define('constraints', dgen_core.RuleRestrictions())
+ while self._next_token().kind == '&':
+ self._read_token('&')
+ if self._next_token().kind == 'other':
+ self._read_token('other')
+ self._read_token(':')
+ restrictions.safety = self._id()
+ return
+ else:
+ restrictions.add(self._bit_expr(context))
+
+ def _rule_restrict_deprecated(self, context):
""" rule_restrict ::= ('&' bitpattern)* ('&' 'other' ':' id)? """
restrictions = context.find('constraints')
@@ -724,7 +741,9 @@
restrictions.safety = self._id()
return
else:
- restrictions.add(self._bitpattern32())
+ restrictions.add(
+ dgen_core.BitPattern.parse(self._bitpattern32(),
+ dgen_core.BitField('constraint', 31, 0)))
def _safety_check(self, context):
"""safety_check ::= id | bit_expr ('=>' id)?

Powered by Google App Engine
This is Rietveld 408576698