acle
acle copied to clipboard
[BUG] CMSE specs: Need examples using new Armv8.1-M instructions to get correct behaviour and show optimal new sequences.
Versions of the CMSE example code that use the new instructions in Armv8.1-M should be created. While some of the instructions (EG CLRM and VSCCLRM) just provide performance and code size improvements, correct usage of the new FPCXT payloads is required to fix an ABI issue.
For example:
-
Many examples (including sections 8.3.1, 8.3.2, 8.3.3, 8.4.2) have a long string of
mov r?, #0
instructions to clear the registers. These can be replaced by the newCLRM
clear multiple instruction. -
The
FPCXTS
payload should be saved and restored around a Secure -> Non-secure call. This should be incorporated into the example shown in section 8.3.1 -
The
FPCXTNS
payload should be saved and restored on entry/exit from acmse_nonsecure_entry
function that either uses floating point, or calls another function that may use floating-point. This could be added to a new version of the example in section 8.4.2, although it might be cleaner to have a simpler example that doesn’t also involve stacked arguments. -
Section 8.4.2 contains the following code to detect if an FP context is active, and to clear the registers if they contain secure data:
@14: check SFPA bit to see if FP is used
mrs r1, control
tst r1, #8
bne .LdoneFP
@15: clear floating point caller-saved registers (soft ABI)
mov r1, #0
vmov s0, s1, r1, r1
vmov s2, s3, r1, r1
...
vmov s30, s31, r1, r1
@16: clear floating point flags
vmsr fpscr, r1
.LdoneFP:
This code can be replaced by the new VSCCLRM
instruction