1 /* CMSE wrapper function used to save, clear and restore callee saved registers
2 for cmse_nonsecure_call's.
4 Copyright (C) 2016-2018 Free Software Foundation, Inc.
5 Contributed by ARM Ltd.
7 This file is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3, or (at your option) any
12 This file is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
17 Under Section 7 of GPL version 3, you are granted additional
18 permissions described in the GCC Runtime Library Exception, version
19 3.1, as published by the Free Software Foundation.
21 You should have received a copy of the GNU General Public License and
22 a copy of the GCC Runtime Library Exception along with this program;
23 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
24 <http://www.gnu.org/licenses/>. */
36 .global __gnu_cmse_nonsecure_call
37 __gnu_cmse_nonsecure_call:
38 #if defined(__ARM_ARCH_8M_MAIN__)
47 /* Save and clear callee-saved registers only if we are dealing with hard float
48 ABI. The unused caller-saved registers have already been cleared by GCC
71 #error "Half precision implementation not supported."
73 /* Clear the cumulative exception-status bits (0-4,7) and the
74 condition code bits (28-31) of the FPSCR. */
81 /* We are not dealing with hard float ABI, so we can safely use the vlstm and
82 vlldm instructions without needing to preserve the registers used for
85 sub sp, sp, #0x88 /* Reserve stack space to save all floating point
86 registers, including FPSCR. */
87 vlstm sp /* Lazy store and clearance of d0-d16 and FPSCR. */
88 #endif /* __ARM_PCS_VFP */
90 /* Make sure to clear the 'GE' bits of the APSR register if 32-bit SIMD
91 instructions are available. */
92 #if defined(__ARM_FEATURE_SIMD32)
105 vlldm sp /* Lazy restore of d0-d16 and FPSCR. */
106 add sp, sp, #0x88 /* Free space used to save floating point registers. */
107 #endif /* __ARM_PCS_VFP */
111 #elif defined (__ARM_ARCH_8M_BASE__)
138 #error "This should only be used for armv8-m base- and mainline."