arm: zext return value parameters
authorSaleem Abdulrasool <compnerd@compnerd.org>
Tue, 10 Oct 2017 18:44:05 +0000 (11:44 -0700)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Tue, 10 Oct 2017 18:46:20 +0000 (11:46 -0700)
commit7ad0ae7f42f3e208431ab66a9032dc9549f978d0
treec6c26f1ba0148751e576a406e6b9e69474474a0f
parent9f1f8741b2ec0c8898ecff7b93005627b915dd02
arm: zext return value parameters

The closure function (invoked as closure->fun in ffi_closure_XXX_inner)
will only populate the actual number of bytes for the true return type,
which may be a character.  This leaves garbage on the stack when the
assembly closure function (i.e. ffi_closure_XXX) reads the return value
off of the stack into r0 as a 4-byte value.  ffi_closure_XXX always
leaves room for at least 4 bytes here, so we can safely set them to 0.
Otherwise, if there is garbage in any of these bytes, these end up in r0
and in the returned value as well.
src/arm/ffi.c