BinaryAnalysisPlatform / bap

Binary Analysis Platform
MIT License
2.07k stars 273 forks source link

adds mode events to traces #1433

Closed thestr4ng3r closed 2 years ago

thestr4ng3r commented 2 years ago

A mode event expresses a switch of some processor mode affecting the execution of all following instructions. The possible values and their meanings depend on the target. At the moment, the only one that uses modes is arm, where the mode indicates whether or not thumb mode is used.

In order to make use of it, it can be provided in Mode.slot of Theory.program, such that the computation Theory.Label.encoding can access it, if available.

thestr4ng3r commented 2 years ago

An alternative would be to just add an encoding field here, as part of code_exec events: https://github.com/BinaryAnalysisPlatform/bap/blob/5b1acc00804a8090c09f6785138e50a42cf00827/lib/bap_traces/bap_trace_event_types.ml#L11-L16 That would be much simpler and would mean "the encoding of this instruction" rather than "switch to a different encoding mode". Depends on what we actually want specifically...

ivg commented 2 years ago

An alternative would be to just add an encoding field here, as part of code_exec events:

https://github.com/BinaryAnalysisPlatform/bap/blob/5b1acc00804a8090c09f6785138e50a42cf00827/lib/bap_traces/bap_trace_event_types.ml#L11-L16

That would be much simpler and would mean "the encoding of this instruction" rather than "switch to a different encoding mode". Depends on what we actually want specifically...

The chunk representation is fixed, we do not want to break protocols and interfaces by changing it.