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

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

Open
cryptwhoa opened this issue Dec 30, 2024 · 0 comments
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

Comments

@cryptwhoa
Copy link

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

@xusheng6 xusheng6 added Type: Enhancement Issue is a small enhancement to existing functionality Component: Architecture Issue needs changes to an architecture plugin Impact: Low Issue is a papercut or has a good, supported workaround Effort: Low Issue should take < 1 week labels Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

2 participants