Skip to content

Commit 594c9cc

Browse files
authored
applies ARM modified immediate (MIC) decoding in more places (#1425)
Previously, we added MIC decoding very conservatively, only to places where we have seen them. Further experiments with qemu tracing showed that we have to apply them in all places where immediates occur.
1 parent b427629 commit 594c9cc

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/arm/arm_mov.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ let lift ?(encoding=Theory.Language.unknown)
4545
| None -> tmp reg32_t
4646
| Some (`Reg reg) -> Env.of_reg reg
4747
| Some (`Imm _) -> fail [%here] "dest is not a reg" in
48-
let s1 : exp = exp_of_op src1 in
48+
let s1 : exp = MIC.decode encoding @@ exp_of_op src1 in
4949
let s2 : exp = match src2 with
50-
| Some src -> exp_of_op src
50+
| Some src -> MIC.decode encoding @@ exp_of_op src
5151
| None -> zero reg32_t in
5252

5353
let unshifted = tmp reg32_t in
@@ -75,7 +75,7 @@ let lift ?(encoding=Theory.Language.unknown)
7575
let shifted, carry = Shift.lift_i
7676
~src:Bil.(var unshifted) simm reg32_t in
7777
s1, shifted, [Bil.move unshifted s2], carry
78-
| _ -> s1, (MIC.decode encoding s2), [], Bil.var Env.cf in
78+
| _ -> s1, s2, [], Bil.var Env.cf in
7979

8080
let stmts, flags = match itype, src1, src2 with
8181
| `MOV, `Imm i64, _

lib/bap_traces/bap_trace_events.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ open Bap_trace_event_types
55

66
let pp_bytes fmt s =
77
let pp fmt s =
8-
String.iter ~f:(fun c -> Format.fprintf fmt "%X@ " (Char.to_int c)) s in
8+
String.iter ~f:(fun c -> Format.fprintf fmt "%02X@ " (Char.to_int c)) s in
99
Format.fprintf fmt "@[<hv>%a@]" pp s
1010

1111
let pp_array pp fmt ar =

0 commit comments

Comments
 (0)