summaryrefslogtreecommitdiff
path: root/src/sim/guest_abi.test.cc
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2019-11-27 21:34:53 -0800
committerGabe Black <gabeblack@google.com>2020-01-13 22:44:49 +0000
commit6c9da52bea73d43f3384dd57594b74dc7fd031c3 (patch)
treebe9a61d9f45d357dc480f1fe2a8c3fb57bcf2db3 /src/sim/guest_abi.test.cc
parent07688f1b4f3679544dde3aa0c426a538499e87d6 (diff)
downloadgem5-6c9da52bea73d43f3384dd57594b74dc7fd031c3.tar.xz
sim: Implement a varargs like mechanism for GuestABI system.
This will let a function called with a GuestABI emulate the ... mechanism available in C. To make that possible without the functions knowing anything about the ABI and to follow C++'s (sensible) templating and virtual function rules, you have to tell VarArgs what types you might want to extract from it, unlike the pure ... varargs style mechanism. Also unlike ..., there is no mechanism in place to force the varargs to appear last in the argument list. It will pick up the progress through the arguments at the point it's reached, and will ignore any later arguments. It would be possible to be more rigorous about this by changing the callFrom templates, but the overhead in complexity is probably not worth it. Also, retrieving arguments through a VarArgs happens live, meaning at the point that the argument is asked for. If the ThreadContext or memory the argument lives in is modified before that point, the retrieved value will reflect that modification and not what the function was originally called with. Care should be taken so that this doesn't cause corrupted arguments. Finally, this mechansim (and the Guest ABI mechanism in general) is complex and should have tests written for it. That should be possible since ThreadContext is forward declared and so the test can say it works however it wants or even ignore it completely. If that changes in the future, we may need a mock ThreadContext implementation. Jira Issue: https://gem5.atlassian.net/browse/GEM5-187 Change-Id: I37484b50a3e8c0d259d9590e32fecbb5f76670c1 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23195 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu> Maintainer: Gabe Black <gabeblack@google.com> Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'src/sim/guest_abi.test.cc')
0 files changed, 0 insertions, 0 deletions