Skip to content

Use .ppc.EMB.apuinfo section in powerpc ELFs to distinguish between APUs (Altivec, SPE, etc.) #6290

@cryptwhoa

Description

@cryptwhoa

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 the Metadata argument passed to it. It would be nice to add sections to the Metadata 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 to cs_open fails; try Architecture["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 to cs_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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions