diff options
| author | Cyrille Bagard <nocbos@gmail.com> | 2014-11-24 06:49:23 (GMT) | 
|---|---|---|
| committer | Cyrille Bagard <nocbos@gmail.com> | 2014-11-24 06:49:23 (GMT) | 
| commit | 96eee784837e6ed4cf9ce5f1cb2e0f8bff8bd9bf (patch) | |
| tree | c7fd1108066e6359766bc18f8883b67b2b7f082f /tools | |
| parent | 2d833afa673b63a1a61e22ea2cdde59ed60b5ad1 (diff) | |
Update the list of handled ARM instructions
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@423 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/d2c/d2c_gram.y | 6 | ||||
| -rw-r--r-- | tools/d2c/d2c_tok.l | 11 | ||||
| -rw-r--r-- | tools/d2c/rules.c | 3 | ||||
| -rw-r--r-- | tools/d2c/rules.h | 3 | 
4 files changed, 16 insertions, 7 deletions
diff --git a/tools/d2c/d2c_gram.y b/tools/d2c/d2c_gram.y index 5deb053..7195e21 100644 --- a/tools/d2c/d2c_gram.y +++ b/tools/d2c/d2c_gram.y @@ -142,7 +142,7 @@ struct action_tmp  %token CONV EQ OP COMMA CP NOT EOR COLON -%token RULES IF EXPR_START EQUAL BINVAL EXPR_END AND THEN SEE +%token RULES IF EXPR_START EQUAL BINVAL IMMVAL EXPR_END AND THEN SEE UNPREDICTABLE  %type <string> COPYRIGHT INS_NAME @@ -164,7 +164,7 @@ struct action_tmp  %type <string> conv_arg_field  %type <expr> rule_cond -%type <string> BINVAL +%type <string> BINVAL IMMVAL  %type <tmpa> action @@ -258,10 +258,12 @@ rule : IF EXPR_START rule_cond EXPR_END THEN action                                  { add_conditional_rule_to_coder(coder, $3, $6.action, $6.details); }  rule_cond : NAME EQUAL BINVAL   { $$ = build_simple_cond_expression($1, CCT_EQUAL, $3); } +          | NAME EQUAL IMMVAL   { $$ = build_simple_cond_expression($1, CCT_EQUAL, $3); }            | EXPR_START rule_cond EXPR_END AND EXPR_START rule_cond EXPR_END                                  { $$ = build_composed_cond_expression($2, COT_AND, $6); }  action : SEE INS_DETAILS { $$.action = CAT_SEE; $$.details = $2; } +       | UNPREDICTABLE   { $$.action = CAT_UNPREDICTABLE; $$.details = NULL; }  %% diff --git a/tools/d2c/d2c_tok.l b/tools/d2c/d2c_tok.l index 50a8d8f..4d31783 100644 --- a/tools/d2c/d2c_tok.l +++ b/tools/d2c/d2c_tok.l @@ -33,7 +33,7 @@ void free_flex_memory(void) ;  %x conv_begin conv_content conv_arg conv_arg_binval -%x rules_begin rules_content rules_cond rules_cond_binval rules_action rules_actin_see +%x rules_begin rules_content rules_cond rules_cond_binval rules_action rules_action_see  %% @@ -112,7 +112,7 @@ void free_flex_memory(void) ;  <conv_content>"}"                   { BEGIN(encoding_content); }  <conv_content>[ \t\n]+              { } -<conv_content>[A-Za-z][A-Za-z0-9]*  { +<conv_content>[A-Za-z][A-Za-z0-9_]* {                                        if (strcmp(yytext, "NOT") == 0) return NOT;                                        else                                        { @@ -143,6 +143,7 @@ void free_flex_memory(void) ;  <encoding_content>"@rules"          { BEGIN(rules_begin); return RULES; } +<rules_content>\/\/[^\n]+           { printf("SKIP '%s'\n", yytext); }  <rules_begin>[ ]+                   { }  <rules_begin>"{"                    { BEGIN(rules_content); }  <rules_content>[ \t\n]+             { } @@ -156,13 +157,15 @@ void free_flex_memory(void) ;  <rules_cond>"'"                     { BEGIN(rules_cond_binval); }  <rules_cond_binval>[01][01]*        { d2c_lval.string = strdup(yytext); return BINVAL; }  <rules_cond_binval>"'"              { BEGIN(rules_cond); } +<rules_cond>[0-9][0-9]*         	{ d2c_lval.string = strdup(yytext); return IMMVAL; }  <rules_cond>")"                     { return EXPR_END; }  <rules_cond>"&&"                    { return AND; }  <rules_cond>";"                     { BEGIN(rules_action); return THEN; }  <rules_action>[ ]+                  { } -<rules_action>"see "                { BEGIN(rules_actin_see); return SEE; } -<rules_actin_see>[^\n]*             { d2c_lval.cstring = yytext; BEGIN(rules_content); return INS_DETAILS; } +<rules_action>"see "                { BEGIN(rules_action_see); return SEE; } +<rules_action_see>[^\n]*            { d2c_lval.cstring = yytext; BEGIN(rules_content); return INS_DETAILS; } +<rules_action>"unpredictable"       { BEGIN(rules_content); return UNPREDICTABLE; }  %% diff --git a/tools/d2c/rules.c b/tools/d2c/rules.c index 25ba76c..a868864 100644 --- a/tools/d2c/rules.c +++ b/tools/d2c/rules.c @@ -424,6 +424,9 @@ bool write_decoding_rules(decoding_rules *rules, int fd, const coding_bits *bits                  *exit = true;                  break; +            case CAT_UNPREDICTABLE: +                break; +          }          dprintf(fd, "\t\t}\n"); diff --git a/tools/d2c/rules.h b/tools/d2c/rules.h index a4a9bb4..8530d76 100644 --- a/tools/d2c/rules.h +++ b/tools/d2c/rules.h @@ -66,7 +66,8 @@ cond_expr *build_composed_cond_expression(cond_expr *, CondOpType, cond_expr *);  /* Conséquence en cas de condition remplie */  typedef enum _CondActionType  { -    CAT_SEE                                 /* Renvoi vers une instruction */ +    CAT_SEE,                                /* Renvoi vers une instruction */ +    CAT_UNPREDICTABLE                       /* Cas de figure improbable    */  } CondActionType;  | 
