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

[RzIL] IL lifting of SuperH ISA #2518

Merged
merged 123 commits into from
Aug 1, 2022
Merged

[RzIL] IL lifting of SuperH ISA #2518

merged 123 commits into from
Aug 1, 2022

Conversation

DMaroo
Copy link
Member

@DMaroo DMaroo commented Apr 7, 2022

Your checklist for this pull request

  • I've read the guidelines for contributing to this repository
  • I made sure to follow the project's coding style
  • I've documented or updated the documentation of every function and struct this PR changes. If not so I've explained why.
  • I've added tests that prove my fix is effective or that my feature works (if possible)
  • I've updated the rizin book with the relevant information (if needed)

Detailed description

Lifting SuperH ISA to RzIL.
Architecture reference: https://www.st.com/resource/en/user_manual/cd00147165-sh-4-32-bit-cpu-core-architecture-stmicroelectronics.pdf

I have also implemented a disassembler and assembler for SuperH.

Test plan

Add one IL test for every lifted instruction.

I have added one IL test for every instruction which was implemented. It is yet to be tested against rz-tracetest, but the asm tests are passing.

Closing issues

Tracking issue: #2080

Unimplemented instructions

  • LDTLB
  • OCBI
  • OCBP
  • OCBWB
  • PREF
  • TRAPA
  • All floating point instructions are unimplemented, in the disassembler and assembler, as well as in the IL
  • Delayed branch jumps are also implemented as just normal jumps
  • For LDC and STC, the instruction involving banked registers as the operands is unimplemented (more like incorrectly implemented) in the IL

@DMaroo DMaroo changed the title [RzIL] IL uplifting of SuperH ISA [RzIL] IL lifting of SuperH ISA Apr 7, 2022
@XVilka XVilka mentioned this pull request Apr 9, 2022
38 tasks
@github-actions github-actions bot added the API label Apr 12, 2022
@XVilka XVilka added the RZIL label Apr 24, 2022
Copy link
Member

@XVilka XVilka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is in a good shape.

librz/analysis/arch/arm/arm_il64.c Outdated Show resolved Hide resolved
librz/analysis/arch/sh/sh_il.c Outdated Show resolved Hide resolved
librz/analysis/arch/sh/sh_il.c Outdated Show resolved Hide resolved
librz/analysis/arch/sh/sh_il.c Outdated Show resolved Hide resolved
librz/analysis/arch/sh/sh_il.c Outdated Show resolved Hide resolved
  * Link both `sh/assembler.c` and `sh/disassembler.c` with `sh/lookup.c`
  * Store the IL context in an `SHILContext` struct and pass it around
    to store information to be used outside the lifter
  * Remove incorrect comments
  * Remove unnecessary helper `sh_return_val_if_invalid_gpr`
  * Also fix bugs in the corresponding liftings, if any
  * Also fix IL liftings for incorrectly implemented shift instructions
  * Fix disassmbler/assembler lookup table for incorrectly decoded shift
    instructions
  * Fix IL lifter for incorrectly implemented branch instructions
  * Now the assembler and dissasembler find the correct instruction from
    the lookup table in case of `LDC` (and `STC` as well)
  * Banked register instructions are also assembled and disassembled
    properly
  * Add banked registers in `sh_registers`
  * Add tests for `LDC`
  * Fix `sh_il_set_status_reg` to use `LSB` leading to concise IL dumps
  * Add a member in `SHILContext`, `use_banked` to decide whether to use
    banked registers or not in case privileged mode. Very helpful in
    case of `LDC`, `LDC.L`, `STC`, `STC.L`
  * Fix `sh_il_get_status_reg` to use remove double casting and use
    appropriate bits for `SH_SR_I`
  * Fix incorrectly implemented system control IL lifters
@DMaroo DMaroo merged commit d44b574 into dev Aug 1, 2022
@DMaroo DMaroo deleted the sh-uplifting branch August 1, 2022 21:07
wingdeans pushed a commit to wingdeans/rizin that referenced this pull request Aug 3, 2022
	* Add an assembler for the SuperH ISA
	* Rewrite GPL GNU disassembler code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants