Commit ea29755a authored by Axel Simon's avatar Axel Simon

add options for RReil generation

parent 89ae1724
......@@ -443,6 +443,7 @@ int main (int argc, char** argv) {
#else
0;
#endif
int_t rreil_options;
int_t run_translate = 0;
int_t translate_options = 0;
size_t base_address = 0;
......@@ -481,6 +482,18 @@ int main (int argc, char** argv) {
break;
}
if (gdsl_has_conf(s,config)) continue;
#endif
#if defined(gdsl_rreil_config)
for (config = gdsl_rreil_config(s); gdsl_has_conf(s,config);
config = gdsl_conf_next(s,config))
if (strcmp(arg,gdsl_conf_short(s,config))==0) {
if (negated)
rreil_options &= ~gdsl_conf_data(s,config);
else
rreil_options |= gdsl_conf_data(s,config);
break;
}
if (gdsl_has_conf(s,config)) continue;
#endif
if (strncmp(arg,"base=",5)==0) {
int res=readNum(arg+5,&base_address);
......@@ -509,6 +522,16 @@ int main (int argc, char** argv) {
gdsl_conf_long(s,config),
gdsl_conf_short(s,config),
gdsl_conf_data(s,config) & decode_options ? "" : "*");
#endif
#if defined(gdsl_rreil_config)
for (config = gdsl_rreil_config(s); gdsl_has_conf(s,config);
config = gdsl_conf_next(s,config))
fprintf(stderr," --%s\t\t%s%s\n --no-%s%s\t\tnegated option\n",
gdsl_conf_short(s,config),
gdsl_conf_data(s,config) & rreil_options ? "*" : "",
gdsl_conf_long(s,config),
gdsl_conf_short(s,config),
gdsl_conf_data(s,config) & rreil_options ? "" : "*");
#endif
fprintf(stderr,"The default is denoted by *.\n");
return 1;
......@@ -555,7 +578,7 @@ int main (int argc, char** argv) {
obj_t rreil = gdsl_decode_translate_block_optimized(s,
decode_options,
gdsl_int_max(s),
2);
rreil_options);
obj_t res = gdsl_rreil_pretty(s,rreil);
string_t str = gdsl_merge_rope(s,res);
if (print_addr) printf("0x%016lx:\n",address);
......
export decode-translate-block-optimized: (decoder-configuration, int, int) -> S sem_stmt_list <{} => {}>
export decode-translate-block-optimized-insncb: (decoder-configuration, int, int, insn_list_obj, (insn_list_obj, insndata) -> insn_list_obj) -> S opt-result <{} => {}>
export decode-translate-block-optimized: (decoder-configuration, int, rreil-configuration) -> S sem_stmt_list <{} => {}>
export decode-translate-block-optimized-insncb: (decoder-configuration, int, rreil-configuration, insn_list_obj, (insn_list_obj, insndata) -> insn_list_obj) -> S opt-result <{} => {}>
type sem_preservation =
SEM_PRESERVATION_EVERYWHERE
......@@ -39,24 +39,21 @@ type opt-result = {
rreil: sem_stmt_list
}
val decode-translate-block-optimized-insncb config limit pres insns-initv insn-append = do
# limit <- return (limit + 0);
# pres <- return (pres + 0);
val decode-translate-block-optimized-insncb config limit rreil-config insns-initv insn-append = do
update @{insns=insns-initv};
rreil <- case pres of
0: decode-translate-block-optimized-insncb-inner config limit SEM_PRESERVATION_EVERYWHERE insn-append
| 1: decode-translate-block-optimized-insncb-inner config limit SEM_PRESERVATION_BLOCK insn-append
| 2: decode-translate-block-optimized-insncb-inner config limit SEM_PRESERVATION_CONTEXT insn-append
rreil <- case rreil-config of
'00.': decode-translate-block-optimized-insncb-inner config limit SEM_PRESERVATION_EVERYWHERE insn-append
| '01.': decode-translate-block-optimized-insncb-inner config limit SEM_PRESERVATION_BLOCK insn-append
| '1..': decode-translate-block-optimized-insncb-inner config limit SEM_PRESERVATION_CONTEXT insn-append
end;
insns <- query $insns;
return {rreil=rreil, insns=insns}
end
val decode-translate-block-optimized config limit pres = let
val decode-translate-block-optimized config limit rreil-config = let
val default-append a b = a
in do
result <- decode-translate-block-optimized-insncb config limit pres INSN_LIST_OBJ default-append;
result <- decode-translate-block-optimized-insncb config limit rreil-config INSN_LIST_OBJ default-append;
return result.rreil
end end
......
......@@ -4,6 +4,15 @@ export decode-translate-block-insns: (decoder-configuration, int, (insn_list_obj
export decode-translate-super-block: (decoder-configuration, int) -> S translate-result <{insns: insn_list_obj} => {insns: insn_list_obj}>
export select_ins_count: S int <{ins_count: int} => {ins_count: int}>
export succ-pretty: (stmts_option, string) -> rope
export rreil-config : configuration[vec=rreil-configuration]
type rreil-configuration = |3|
val rreil-config =
conf '001' "block" "translate a basic block at a time" &*
conf '010' "liveness" "remove dead assignments" &*
conf '100' "inter-bb" "perform inter-basic block liveness analysis"
val insn-append-default a b = a
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment