rizin icon indicating copy to clipboard operation
rizin copied to clipboard

Add RZIL support for h8300

Open b1llow opened this issue 7 months ago • 5 comments

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 every RZ_API function and struct this PR changes.
  • [ ] I've added tests that prove my changes are effective (required for changes to RZ_API).
  • [ ] I've updated the Rizin book with the relevant information (if needed).

Detailed description

...

Test plan

...

Closing issues

...

b1llow avatar May 04 '25 08:05 b1llow

@imbillow Is it fine for you if we mark this PR as "Draft"? I get confused in my notifications.

Rot127 avatar May 14 '25 16:05 Rot127

where can i find the h8300 isa manual? is this ?

yes

b1llow avatar Jun 01 '25 07:06 b1llow

Codecov Report

:x: Patch coverage is 77.34940% with 470 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 44.85%. Comparing base (fd41e61) to head (2edea18). :warning: Report is 1 commits behind head on dev.

Files with missing lines Patch % Lines
librz/arch/isa/h8300/h8300_esil.c 36.66% 224 Missing and 23 partials :warning:
librz/arch/isa/h8300/h8300_il.c 78.45% 59 Missing and 97 partials :warning:
librz/arch/p/analysis/analysis_h8300.c 84.89% 19 Missing and 10 partials :warning:
librz/arch/isa/h8300/h8300_disas.c 96.40% 15 Missing and 12 partials :warning:
librz/arch/isa/h8300/h8300_dwarf_regnum_table.h 0.00% 9 Missing :warning:
librz/arch/dwarf_process.c 50.00% 1 Missing and 1 partial :warning:
Additional details and impacted files
Files with missing lines Coverage Δ
librz/arch/p/asm/asm_h8300.c 100.00% <100.00%> (ø)
librz/bin/format/elf/elf_info.c 71.03% <ø> (ø)
librz/il/il_reg.c 61.99% <100.00%> (+0.17%) :arrow_up:
librz/include/rz_util/rz_bits.h 100.00% <100.00%> (ø)
librz/arch/dwarf_process.c 61.31% <50.00%> (-0.04%) :arrow_down:
librz/arch/isa/h8300/h8300_dwarf_regnum_table.h 0.00% <0.00%> (ø)
librz/arch/isa/h8300/h8300_disas.c 96.59% <96.40%> (+16.96%) :arrow_up:
librz/arch/p/analysis/analysis_h8300.c 86.07% <84.89%> (+85.48%) :arrow_up:
librz/arch/isa/h8300/h8300_il.c 78.45% <78.45%> (ø)
librz/arch/isa/h8300/h8300_esil.c 36.66% <36.66%> (ø)

... and 9 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update fd41e61...2edea18. Read the comment docs.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Jun 01 '25 11:06 codecov[bot]

The h8300 is mostly done, but the elf file I compiled with h8300-elf-gcc -mn has h8300h-specific instructions, and considering that h8300h seems to be just an extension of h8300, I'm going to do the two together?

b1llow avatar Jun 02 '25 17:06 b1llow

The h8300 is mostly done, but the elf file I compiled with h8300-elf-gcc -mn has h8300h-specific instructions, and considering that h8300h seems to be just an extension of h8300, I'm going to do the two together?

Yes, please do it in the same PR.

See https://github.com/rizinorg/rizin/issues/4787

Though, I recommend adding only the minimum necessary in this PR (just H8/300H but not the rest), and other variants in separate PRs.

notxvilka avatar Jun 02 '25 17:06 notxvilka

the main.elf is built using this: https://github.com/celerizer/h8300h-test-rom.git

b1llow avatar Jul 31 '25 03:07 b1llow

The thing I am concerned about is, that if some semantics there are wrong, the debugging effort of the bugs emerging from it will be enormous. These bugs are potentially very subtle.

There is H8 emulator but I don't know how good it is: https://github.com/celerizer/libh8300h Maybe it's suitable for the tracetesting, maybe it's not.

notxvilka avatar Jul 31 '25 12:07 notxvilka

However, there doesn't seem to be a good solution. The ISA description is not as strict as the code in some places, and there doesn't seem to be a reliable simulator for h8300 to perform trace tests.

b1llow avatar Aug 02 '25 18:08 b1llow

Please send all further improvements as separate PRs. Merged this one. Thank you for this one last blocker (apart from nearly finished SPARC) for ESIL deprecation in analysis!

notxvilka avatar Aug 04 '25 04:08 notxvilka