unstable-book: Update cmse feature descriptions · rust-lang/rust@3beed38 (original) (raw)
2 files changed
lines changed
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| 1 | -# `abi_c_cmse_nonsecure_call` | |
| 1 | +# `abi_cmse_nonsecure_call` | |
| 2 | 2 | |
| 3 | 3 | The tracking issue for this feature is: [#81391] |
| 4 | 4 | |
| @@ -14,10 +14,9 @@ LLVM, the Rust compiler and the linker are providing | ||
| 14 | 14 | [support](https://developer.arm.com/documentation/ecm0359818/latest/) for the |
| 15 | 15 | TrustZone-M feature. |
| 16 | 16 | |
| 17 | -One of the things provided, with this unstable feature, is the | |
| 18 | -`C-cmse-nonsecure-call` function ABI. This ABI is used on function pointers to | |
| 19 | -non-secure code to mark a non-secure function call (see [section | |
| 20 | -5.5](https://developer.arm.com/documentation/ecm0359818/latest/) for details). | |
| 17 | +One of the things provided with this unstable feature is the "cmse-nonsecure-call" function ABI. | |
| 18 | +This ABI is used on function pointers to non-secure code to mark a non-secure function call | |
| 19 | +(see [section 5.5](https://developer.arm.com/documentation/ecm0359818/latest/) for details). | |
| 21 | 20 | |
| 22 | 21 | With this ABI, the compiler will do the following to perform the call: |
| 23 | 22 | * save registers needed after the call to Secure memory |
| @@ -28,19 +27,16 @@ With this ABI, the compiler will do the following to perform the call: | ||
| 28 | 27 | To avoid using the non-secure stack, the compiler will constrain the number and |
| 29 | 28 | type of parameters/return value. |
| 30 | 29 | |
| 31 | -The `extern "C-cmse-nonsecure-call"` ABI is otherwise equivalent to the | |
| 32 | -`extern "C"` ABI. | |
| 33 | - | |
| 34 | 30 | |
| 35 | 31 | |
| 36 | 32 | ``` rust,ignore |
| 37 | 33 | #![no_std] |
| 38 | -#![feature(abi_c_cmse_nonsecure_call)] | |
| 34 | +#![feature(abi_cmse_nonsecure_call)] | |
| 39 | 35 | |
| 40 | 36 | #[no_mangle] |
| 41 | 37 | pub fn call_nonsecure_function(addr: usize) -> u32 { |
| 42 | 38 | let non_secure_function = |
| 43 | - unsafe { core::mem::transmute::<usize, extern "C-cmse-nonsecure-call" fn() -> u32>(addr) }; | |
| 39 | + unsafe { core::mem::transmute::<usize, extern "cmse-nonsecure-call" fn() -> u32>(addr) }; | |
| 44 | 40 | non_secure_function() |
| 45 | 41 | } |
| 46 | 42 | ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -14,10 +14,9 @@ LLVM, the Rust compiler and the linker are providing | ||
| 14 | 14 | [support](https://developer.arm.com/documentation/ecm0359818/latest/) for the |
| 15 | 15 | TrustZone-M feature. |
| 16 | 16 | |
| 17 | -One of the things provided, with this unstable feature, is the | |
| 18 | -`C-cmse-nonsecure-entry` ABI. This ABI marks a Secure function as an | |
| 19 | -entry function (see [section | |
| 20 | -5.4](https://developer.arm.com/documentation/ecm0359818/latest/) for details). | |
| 17 | +One of the things provided with this unstable feature is the "cmse-nonsecure-entry" ABI. | |
| 18 | +This ABI marks a Secure function as an entry function (see | |
| 19 | +[section 5.4](https://developer.arm.com/documentation/ecm0359818/latest/) for details). | |
| 21 | 20 | With this ABI, the compiler will do the following: |
| 22 | 21 | * add a special symbol on the function which is the `__acle_se_` prefix and the |
| 23 | 22 | standard function name |
| @@ -28,9 +27,7 @@ With this ABI, the compiler will do the following: | ||
| 28 | 27 | |
| 29 | 28 | Because the stack can not be used to pass parameters, there will be compilation |
| 30 | 29 | errors if: |
| 31 | -* the total size of all parameters is too big (for example more than four 32 | |
| 32 | - bits integers) | |
| 33 | -* the entry function is not using a C ABI | |
| 30 | +* the total size of all parameters is too big (for example, more than four 32-bit integers) | |
| 34 | 31 | |
| 35 | 32 | The special symbol `__acle_se_` will be used by the linker to generate a secure |
| 36 | 33 | gateway veneer. |
| @@ -42,7 +39,7 @@ gateway veneer. | ||
| 42 | 39 | #![feature(cmse_nonsecure_entry)] |
| 43 | 40 | |
| 44 | 41 | #[no_mangle] |
| 45 | -pub extern "C-cmse-nonsecure-entry" fn entry_function(input: u32) -> u32 { | |
| 42 | +pub extern "cmse-nonsecure-entry" fn entry_function(input: u32) -> u32 { | |
| 46 | 43 | input + 6 |
| 47 | 44 | } |
| 48 | 45 | ``` |