matt-kempster / m2c

A MIPS and PowerPC decompiler.
GNU General Public License v3.0
386 stars 46 forks source link

Issue decompiling from PowerPC ASM generated by IDA Pro #264

Open kernaltrap8 opened 10 months ago

kernaltrap8 commented 10 months ago

Hello, I disassembled a ELF from a Playstation 3 and exported it as ASM, however when running it through m2c it gives me this error:

PS C:\cygwin\home\693982\m2c> python3 m2c.py ..\WoRmod\binary\src\EBOOT.asm --target ppc-mwcc-c
/*
Decompilation failure:

unsupported non-nop instruction outside of function (OPDEntry struc)
*/

I don't know why this isn't working. Does m2c not support AltiVec PowerPC?

SeekyCt commented 10 months ago

Yeah, it's just the gc/wii instruction set currently, no altivec

kernaltrap8 commented 10 months ago

ah i see. thank you for replying. let me know when AltiVec support is added.

On Mon, Aug 28, 2023 at 12:31 PM Seeky @.***> wrote:

Yeah, it's just the gc/wii instruction set currently, no altivec

— Reply to this email directly, view it on GitHub https://github.com/matt-kempster/m2c/issues/264#issuecomment-1696075955, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWQYZDSUXCKYLP6BTNREZN3XXTIWHANCNFSM6AAAAAA4BWXMXU . You are receiving this because you authored the thread.Message ID: @.***>

simonlindholm commented 10 months ago

Can you post the asm you're trying? The issue you're hitting isn't about altivec, it looks like a formatting thing. I imagine altivec instructions won't occur very commonly so m2c might work alright most of the time (although probably not as well as ghidra; we haven't put too much effort into ppc support).

kernaltrap8 commented 10 months ago

Can you post the asm you're trying? The issue you're hitting isn't about altivec, it looks like a formatting thing. I imagine altivec instructions won't occur very commonly so m2c might work alright most of the time (although probably not as well as ghidra; we haven't put too much effort into ppc support).

its a whole program, about 250MB of assembly. i can upload it and send it here, if you like. its just the direct dump from the ELF in IDA Pro.

simonlindholm commented 10 months ago

can you try to run m2c on just the first function of it, and post that here if it doesn't work?

kernaltrap8 commented 10 months ago

can you try to run m2c on just the first function of it, and post that here if it doesn't work?

how do i specify just a function? sorta like this? python3 m2c.py EBOOT.asm [function]

simonlindholm commented 10 months ago

Yes, that works. But I was thinking you could modify the .asm file to include just a single function, to have something to post here that's easier to work with and less infringing on copyright.