Xtensa cleanups and XEA3 support (#677)
* xtensa: clean up stack usage in ffi_trampoline call
Space for outgoing call arguments reserved in the stack frame of the
function ffi_trampoline overlaps register spill overflow area at the
top of the frame. In xtensa XEA2 exception architecture the layout of
overlapping areas is identical so that even if the ffi_trampoline
registers frame gets spilled the memory contents doesn't change.
This is not so with the xtensa XEA3 exception architecture, where
registers a0 - a7 of a different function are spilled in that location.
Reserve spill area for 8 registers to avoid overlapping of the spill
area with the outgoing call arguments area in the ffi_trampoline.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
* xtensa: support xtensa XEA3 exception architecture
XEA3 requires that 32 bytes of register spill area is reserved in all
functions. Fix ffi_cacheflush entry instruction to satisfy this
requirement.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
* xtensa: maintain stack alignment
xtensa ABI requires stack alignment on 16 byte boundary and passing
up to 6 arguments in registers. To simplify stack alignment maintenance
fixed amount of stack space is reserved for arguments passed in
registers and variable but correctly aligned amount is reserved for the
remaining arguments. After copying arguments to the stack and loading
registers the fixed part of the stack reservation is freed.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
* xtensa: fix err_bad_abi tests
Check ffi_cif::abi value in the ffi_prep_closure_loc and return
FFI_BAD_ABI error if it's not one of the supported values.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>