sim: Add a GuestABI mechanism to allocate space for a return value.
Some ABIs (including 32 bit ARM, 64 bit x86) allocate their argument
registers differently depending on their return value. For instance,
if the value needs to be returned in memory because it's too big,
the caller could pass a pointer to where the result should be stored
when the function returns. This pointer acts like an invisible first
argument, offsetting where all the normal arguments actually live.
This change adds a mechanism to handle that case. The Result templates
can now declare an allocate() static method which is given a
ThreadContext *, and a reference to the Position object. It can perform
any adjustment it needs to before the normal argument extraction
Maintainer: Gabe Black <email@example.com>
Tested-by: kokoro <firstname.lastname@example.org>
Reviewed-by: Jason Lowe-Power <email@example.com>
2 files changed