Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] CMSE specs: Need examples using new Armv8.1-M instructions to get correct behaviour and show optimal new sequences. #210

Open
696GrocuttT opened this issue Jul 20, 2022 · 0 comments · May be fixed by #264
Labels
enhancement New feature or request proposal

Comments

@696GrocuttT
Copy link

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 new CLRM 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 a cmse_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

@696GrocuttT 696GrocuttT added the bug Something isn't working label Jul 20, 2022
@fpetrogalli fpetrogalli added enhancement New feature or request proposal and removed bug Something isn't working labels Jul 21, 2022
@fpetrogalli fpetrogalli removed their assignment Sep 5, 2022
@vhscampos vhscampos linked a pull request Jun 13, 2023 that will close this issue
8 tasks
@vhscampos vhscampos linked a pull request Jun 13, 2023 that will close this issue
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request proposal
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants