-
-
Notifications
You must be signed in to change notification settings - Fork 361
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
[Hexagon] RzIL uplifiting #3837
Conversation
3f283a4
to
16d421e
Compare
Open this for the first round of review now. There are still the Currently the tests fail due to missing #3973 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks great. Amazing job!
newest = i; | ||
} | ||
} | ||
RZ_LOG_DEBUG("╭─────┬──────────────┬─────┬──────────────────┬───────────────╮\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have general API for that, inside RzTable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't do the last column which is split into 4, which makes it easier to read IMHO. Do you think it is still better? Then I change it. Though it is only debug printing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was just a remark, not a requirement. But it would be nice to figure out what's missing in RzTable.
In order that the tests succeed we need rizinorg/rizin-testbins#127 merged though. |
@thestr4ng3r To your notice: 722e5c0 |
73071a3
to
8f18e32
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mostly is ok. just a stupid detail for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but it would be nice to extract non-Hexagon changes in a separate PR and merge it first.
Please let me run all |
Add hexagon il code to rouce files. Update generated files Add undocumented ops file. Fix build: Add missing effects. Update generated files. Degrade/remove very common log messages. Rename: p -> pkt and k -> slot Reverse renaming of k, since it is indeed the location in the packet and not the slot. Add slot to HexInsn (needed for RzIL) Uppdate generated files. Disassemble a full packet if it is in the buffer. Allow to get the packet IL ops if they are ready. Only copy disassembly result if requested. Fix typo Fix packet recognition of first and jump target packets. Remove check for theoretically unreachable effects. The assumptions made in this line doesn't need to be true. For Hexagon every write to a register first happens to a temporary register file. Once the whole packet is checked and is valid, the operations are performed. The last step is to sync the the temporary register file with the default one. Update generated files (16 passed test_*) Restructure generated rzil code Update with optimization by resolving compares and tenaries All test_* cases succeed Update source files with new sub-routines Remove pseudo instructions Update generated files (all tests pass). Update source after rebase Fix: Check rw overlap only for x registers. Add RzIL tests for hexagon. Update generated files Remove unit test for further effect after control effect. Update generated files. Fix unit test. After instructions with invalid decoded registers are decoded as invalid, the unit test failed. Fix syntactical changes in tests. Use upper case register names in CC Fix many many mem leaks. Only generate IL code if requested. Enable load_align test. Fix syntax: Remove trailing ; for invalid decodes with parse_bits == 0. Add angle brakcets type annotations. Remove many ressource leaks. Note that not RzAsm and RzAnalysis for Hexagon cannot be freed, because there is currrently no reasonable way to make the plugin thread safe. Add bitmaps Use RzBitmap instead of manually setting bits. Fix type annotations. Triple test timeout for ASAN tests. Fix type annotation. Use PVector instead of Vector to save the HexILOp pointer. Ignore dwarf error for now. Apparently, mixing allocated and static memory in a vector leaks the allocated memory. rip. Replace bitmaps with bitvectors. Ensure packet il stats reset. Remove warning from test
It is dictated by BAP theory that the jumps come last.
Ok, all good now:
|
Hi, just a question. Is the curent dev branch of rizin using latest changes from https://github.com/rizinorg/rz-hexagon and https://github.com/rizinorg/rz-rzilcompiler ? |
@Matheus-Garbelini Yes. If you plan doing research on Hexagon firmware you can ping me on our Mattermost as well. |
SQUASH ME
commit message: Uplift Hexagon architecture to RzIL
The general structure is, that every (sub-)instruction has a getter for it's RzIL code.
Calling the getter will return the RzIL operation.
If RzIL for an instruction is requested, the plugin makes a decision. Because Hexagon only executes whole instruction packets. If the instruction is not the last instruction in a packet, it will simply return
EMPTY()
. If the RzIL for the last instruction in a packet is requested, it will get the RzIL operations for all instructions in the packet, shuffles them into the correct execution order (according to some rules) and returns the complete operation for the packet.The RzIL code was entirely generated with the rzil-compiler, using the semantic definition of the QEMU Hexagon module.
Currently successful compile instructions (and tested):
It was tested with:
rz-tracetest
against the execution trace of the QEMU Hexagon test binaries.main
orloc.pass
symbol), partially testing it executes correctly.For the uplifting several changes and modernization had to be made:
d
for registerRd
) as in the ISA (for mapping in the RzIL code).C20
-C29
(not yet present in LLVM)Your checklist for this pull request
Detailed description
Hexagon uplifting PR.
TODO after merge
rz-rzilcompiler
RizinOrg
rz-rzilcompile
asv1.0
rz-hexagon
RizinOrg
reporz-rzilcompiler
rz-hexagon
to build as proper python package.rz-hexagon
asv1.1
Test plan
Added, all green