1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
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)
}
```
|