ghidra icon indicating copy to clipboard operation
ghidra copied to clipboard

Unmodelable Calling Conventions

Open astrelsky opened this issue 2 years ago • 2 comments

Describe the bug I am elevating #4551 to an issue.

To Reproduce Steps to reproduce the behavior:

  1. Attempt to create a calling convention from the V2 specification from the documentation linked in the discussion.

Expected behavior It should be possible to implement any static calling convention. By static I simply mean to exclude the special dynamic calling convention handling used in the Dalvik cspec.

Additional context I think that allowing joined registers in a group would be a good start.

astrelsky avatar Sep 01 '22 11:09 astrelsky

Sorry, my (deleted) previous post was incorrect as things have envolved. We will have to look into the join must overlap sequential entries issue. Unfortunately, while all of this may help with the foward direction (i.e., auto storage allocation when signature is know) it may not be handled well by decompiler since ordinal assignments (i.e., parameter sequence) would be inderterminate.

ghidra1 avatar Sep 02 '22 18:09 ghidra1

Sorry, my (deleted) previous post was incorrect as things have envolved. We will have to look into the join must overlap sequential entries issue. Unfortunately, while all of this may help with the foward direction (i.e., auto storage allocation when signature is know) it may not be handled well by decompiler since ordinal assignments (i.e., parameter sequence) would be inderterminate.

You lied to me?!? I didn't even see the previous post before it was deleted so no worries.

I do have more problems from the processor/compiler from hell though. A far pointer is 3 bytes but PUSH/POP instructions are only for 2 byte values/registers. So when it pushes a far pointer the segment portion gets reversed (low high trash segment) and no matter how the custom storage is defined the pointer gets split up at the start of the function. I already tried to see if I could join to different stack locations like you can with a register but it didn't allow it.

astrelsky avatar Sep 04 '22 14:09 astrelsky