blob: e5f356ef4d50a0d3e3d058503436e88f03681c9b [file] [log] [blame] [view]
Functions marked as `cmse-nonsecure-call` place restrictions on their
inputs and outputs.
- inputs must fit in the 4 available 32-bit argument registers. Alignment
is relevant.
- outputs must either fit in 4 bytes, or be a foundational type of
size 8 (`i64`, `u64`, `f64`).
- no generics can be used in the signature
For more information,
see [arm's aapcs32](https://github.com/ARM-software/abi-aa/releases).
Erroneous code example:
```ignore (host errors will not match for target)
#![feature(abi_cmse_nonsecure_call)]
#[no_mangle]
pub fn test(
f: extern "cmse-nonsecure-call" fn(u32, u32, u32, u32, u32) -> u32,
) -> u32 {
f(1, 2, 3, 4, 5)
}
```
Arguments' alignment is respected. In the example below, padding is inserted
so that the `u64` argument is passed in registers r2 and r3. There is then no
room left for the final `f32` argument
```ignore (host errors will not match for target)
#![feature(abi_cmse_nonsecure_call)]
#[no_mangle]
pub fn test(
f: extern "cmse-nonsecure-call" fn(u32, u64, f32) -> u32,
) -> u32 {
f(1, 2, 3.0)
}
```