Skip to content

Commit ddef450

Browse files
committed
notes on const fn
1 parent 5616dba commit ddef450

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

text/0000-cmse-calling-conventions.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,16 @@ Currently both ABIs disallow the use of c-variadics. For `cmse-nonsecure-entry`,
108108
- but accepts c-variadic nonsecure calls: https://godbolt.org/z/5rdK58ar4
109109

110110
For `cmse-nonsecure-call`, we may stabilize c-variadics at some point in the future.
111+
112+
### Support for `const fn`
113+
114+
No special support for calling cmse functions is needed.
115+
116+
Evaluating entry functions during constant evaluation is valid. The context switch from non-secure to secure mode is handled by the veneer, which is not visible to rust code. Clearing of registers is not relevant for constant evaluation.
117+
118+
The `cmse-nonsecure-call` calling convention can only be used on function pointers, which cannot be evaluated during constant evaluation.
119+
120+
Miri is not a register machine, so the clearing of registers is not relevant. The context switching also does not need to be considered. Miri will continue to execute where actual hardware hits a hardfault, but this is similar to a standard rust process trying to read memory that the kernel has protected.
111121
### Warn on partially uninitialized values crossing the secure boundary
112122

113123
Unions and types with padding or niches can contain uninitialized memory, and this uninitialized memory can contain stale secure information. Clang warns when union values cross the security boundary (see https://godbolt.org/z/vq9xnrnEs), and rust does the same.

0 commit comments

Comments
 (0)