Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds armv8 (aarch64) lifter #1291

Merged
merged 23 commits into from
Apr 4, 2021
Merged

adds armv8 (aarch64) lifter #1291

merged 23 commits into from
Apr 4, 2021

Conversation

ivg
Copy link
Member

@ivg ivg commented Apr 2, 2021

Aarch64 lifter (in Primus Lisp)

The lifter is written in Primus Lisp and is complete enough to lift and correctly execute our test binaries. The number of lifted instructions is about 50 but it is easy to add new ones (do not forget to contribute them back to us). I am planning on writing a guide on writing lifters in Primus Lisp but before that (and after that as well) I am always ready to help in our Gitter channel (or in Git Discussions).

During the development of the lifter, I have discovered a few shortcomings which were overcome so the pull request includes some other modifications, including qualify of life changes, bug fixes, and other improvements. They are described in detail below.

Adds --show-addr and --show-memory to bap mc and bap objdump

It is much easier to write lifters with them. Essentially, I am just doing

bap objdump ./exe --show-{memory,bil,insn}

and getting a list of instructions for each chunk of memory and lifting all
that miss semantics.

Removes pseudo-registers special semantics from Primus Lisp lifter

It didn't really work well aside from toy examples, mostly because pseudo-registers were only handled by the Primus Lisp lifter but were left intact by any other semantics provider. This resulted in a situation where pseudo-registers were sometimes handled and sometimes not. This PR moves the responsibility of properly handling pseudo-registers to the semantics itself (i.e., to the core theory instances), which makes perfect sense and immediately enables them for old lifters (e.g., BIL lifter). Therefore, we can now close #1176, there are no more writes or reads from the ZERO register (despite that we didn't touch neither BIL lifter nor MIPS lifter).

Adds Theory.Target.has_roles

A faster way of checking register roles (rather than getting the set of registers that has the role and then checking for set membership)

resolves #1087
resolves #1176

ivg added 22 commits April 2, 2021 15:46
The name to string conversion could throw an error when a name is not
interned, which could happen, for example, when the cache written by
one version of the program is read by another version in which some
name is no longer present. In the case of a missing name we represent
it as `id:<repr>` where `<repr>` is the hexadecimal representation of
the missing name hash.
It makes it much easier to write lifters.
The added semantic primitives are
 - lnot
 - extract
 - concat
 - select

Also tweaked casts and reciprocal to handle static cases. And tweaks
all monoids to choose the most significant (widest) sort instead of
default to the word size.
right now it is not working as expected
the trivial executable works, echo is not yet
@ivg ivg merged commit dd0fef2 into BinaryAnalysisPlatform:master Apr 4, 2021
@ivg ivg deleted the aarch64 branch December 1, 2021 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handling the ZERO register of MIPS ARMv8 (64bit) architecture support
1 participant