Use .ppc.EMB.apuinfo section in powerpc ELFs to distinguish between APUs (Altivec, SPE, etc.) #6290
Labels
Component: Architecture
Issue needs changes to an architecture plugin
Effort: Low
Issue should take < 1 week
Impact: Low
Issue is a papercut or has a good, supported workaround
Type: Enhancement
Issue is a small enhancement to existing functionality
What is the feature you'd like to have?
There are several different powerPC variants with overlapping opcodes, notably Altivec and SPE, among others. Currently, ELFs just pick the default one (Altivec), and there isn't an easy way to override that if it uses SPE, for example.
However, SPE ELFs exist (I wish I had one I could share), and it would be nice to be able to auto-detect them. The way this is done is with the
.ppc.EMB.apuinfo
section in ELFs. PowerPC could define a platform recognizer to dispatch to the correct APU variant, but it needs more information in theMetadata
argument passed to it. It would be nice to add sections to theMetadata
argument so that this would work.Note that at the time of writing, the SPE architecture is defined in
arch_ppc
, capstone isn't routed to correctly use it (the call tocs_open
fails; tryArchitecture["ppc_spe"].get_instruction_text(b"\x10\x00\x00\x00", 0x1000)
in the binaryninja console and it segfaults binaryninja on my box -- note that this isn't a "binaryninja isn't using capstone correctly" issue (other than not checking the call tocs_open
), but a bug in capstone itself)...don't get too hung up on this, I'm hoping to push a PR with a replacement to capstone in a few weeks.Is your feature request related to a problem?
A PowerPC SPE elf is basically unanalyzable by binaryninja right now.
Are any alternative solutions acceptable?
I'm sure there's a way to override the architecture of an ELF, but it would be nice not to have to.
Additional Information:
https://www.nxp.com/docs/en/engineering-bulletin/EB622.pdf
The text was updated successfully, but these errors were encountered: