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

Specific calling convention for variadic arguments #3927

Open
toshipiazza opened this issue Jan 27, 2022 · 0 comments
Open

Specific calling convention for variadic arguments #3927

toshipiazza opened this issue Jan 27, 2022 · 0 comments

Comments

@toshipiazza
Copy link
Contributor

toshipiazza commented Jan 27, 2022

Is your feature request related to a problem? Please describe.

The Qualcomm Hexagon Application Binary Interface specifies a unique calling convention for functions that take variadic arguments:

For [variadic] functions, we pass the named (and typed) parameters in the same manner as for fixed argument list functions. The remainder of the arguments are passed on the stack.

This calling convention differs from most calling conventions I've seen in other architectures, for example:

int snprintf(char *str, char *format, ...);

The first argument str is passed in r0. The second argument format is passed in r1. All subsequent (variadic) arguments are passed on the stack. Whereas the calling convention for ARM would be to enregister all variadic arguments as well.

Describe the solution you'd like

I'd like the cspec to have an extra field to denote that variadic arguments are put on the stack

Alternatively, I'd like to be able to specify a function signature override that can specify custom storage in an Analyzer or from the GUI

Alternatively, I'd like to be able to create a completely custom function prototype/calling convention in an Analyzer so I could create a new calling convention for each variadic function

Additional context

XREF #1595
XREF toshipiazza/ghidra-plugin-hexagon#2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant