NationalSecurityAgency / ghidra

Ghidra is a software reverse engineering (SRE) framework
https://www.nsa.gov/ghidra
Apache License 2.0
50.51k stars 5.77k forks source link

MIPS16e2: ISA Support #3882

Open grant-h opened 2 years ago

grant-h commented 2 years ago

MIPS16e2 is an extension of the MIPS16e ISA. It adds additional instructions on top of the existing ISA.

In doing research on newer MediaTek baseband firmware, we came across this ISA. We hacked together a modified SLEIGH definition for our uses, but our changes need significant refactoring and clean up.

ISA Homepage: https://www.mips.com/products/architectures/ase/ase16e/ MIPS16e2 ISA PDF: https://s3-eu-west-1.amazonaws.com/downloads-mips/documents/MD01172-2B-MIPS16e2-AFP-01.00.pdf

docfate111 commented 8 months ago

Is it possible for me to get access to the modified SLEIGH definitions? @grant-h

grant-h commented 8 months ago

Is it possible for me to get access to the modified SLEIGH definitions? @grant-h

Sure! https://github.com/FirmWire/ghidra

docfate111 commented 8 months ago

@grant-h Thank you

I tried to copy the entire files that were changed to Ghidra 11 from this but I ended up with an error when running analyze_mtk_image

[*] Mapping leftover regions via emulation of custom_mk_ram_info
Traceback (most recent call last):
  File "/home/t/ghidra_11.0_PUBLIC/Ghidra/Features/Base/ghidra_scripts/analyze_mtk_image.py", line 711, in <module>
    main()
  File "/home/t/ghidra_11.0_PUBLIC/Ghidra/Features/Base/ghidra_scripts/analyze_mtk_image.py", line 692, in main
    extract_and_add_mappings(entries_by_name)
  File "/home/t/ghidra_11.0_PUBLIC/Ghidra/Features/Base/ghidra_scripts/analyze_mtk_image.py", line 575, in extract_and_add_mappings
    regions = emulate_custom_mk_ram_info('custom_mk_ram_info')

For using the firmwire/ghidra branch I can't figure out how to install that version of Ghidra - I tried gradle and got an error I did not understand

% gradle -I gradle/support/fetchDependencies.gradle init
Starting a Gradle Daemon (subsequent builds will be faster)

FAILURE: Build failed with an exception.

* What went wrong:
Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
> Could not create service of type PluginResolutionStrategyInternal using BuildScopeServices.createPluginResolutionStrategy().

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
grant-h commented 8 months ago

I tried to copy the entire files that were changed to Ghidra 11

These changes conflict with upstream Ghidra. You cannot copy them over the newer versions. Only that version of Ghidra from the repository is supported as-is. For that version of Ghidra, you may need to downgrade your version of gradle.

docfate111 commented 8 months ago

I tried to copy the entire files that were changed to Ghidra 11

These changes conflict with upstream Ghidra. You cannot copy them over the newer versions. Only that version of Ghidra from the repository is supported as-is. For that version of Ghidra, you may need to downgrade your version of gradle.

Thanks @grant-h Is this supposed to be forked from Ghidra 10.2 with some plugin that creates the Ghidra/Processor/MIPS/src directory?

Shangzewen commented 4 months ago

Any Update on this issue?