Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I recently had the need for a symbolic execution engine with nice Rust bindings (or even better, written in Rust) and MIPS support. The first thing worked out well here, the second thing required a bit of work, but it now works nicely :)
The main problem with MIPS support was handling of delay slots. I decided to handle them using the existing (but by default disabled) explicit delay-slot related operations in ESIL strings. See for details on my changes on the radare side radareorg/radare2#23307. The other thing was putting the right return address in the backtrace, but this works nicely since the
fail
address is already delay slot aware. Note that the handling of delay slots is incomplete, in the sense that "likely" instructions are not handled correctly. Those instructions only execute the delay slot if the branch is taken. It should be straight forward to do this properly by changing the ESIL of those instructions toAlso note that currently only a single delay slot is supported. Extending the code to multiple delay slots should be straight forward as well, e.g., by making
delay
a counter.However, this patch is everything but clean, thus only a draft PR. Mostly for reference (on what to do do, or not to do) if you, or any other contributor, ever want to add delay slot support. The main blockers are:
boolector
would abort if two states independently created the same symbolic memory. Since I also don't found a way to check if a variable already exists in a solver (boolector
would just abort if it doesn't ...?!?! ... it would probably be an easy change on their side to provide such a method) I introduced this ugly inefficiency.There are some other things, like adding doc comments, renaming things in a (IMO) descriptive way, which shouldn't me major problems though.
Thanks for creating this great project! If you want to add delay slot support I'd be happy to discuss my experience with you.
Cheers