[PATCH 7/7, GCC, ARM, V8M] Added support for ARMV8-M Security Extension cmse_nonsecure_caller intrinsic

Kyrill Tkachov kyrylo.tkachov@foss.arm.com
Wed Nov 9 10:27:00 GMT 2016


Hi Andre,

On 25/10/16 17:30, Andre Vieira (lists) wrote:
> On 24/08/16 12:01, Andre Vieira (lists) wrote:
>> On 25/07/16 14:28, Andre Vieira (lists) wrote:
>>> This patch adds support ARMv8-M's Security Extension's
>>> cmse_nonsecure_caller intrinsic. This intrinsic is used to check whether
>>> an entry function was called from a non-secure state.
>>> See Section 5.4.3 of ARM®v8-M Security Extensions: Requirements on
>>> Development Tools
>>> (http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/index.html)
>>> for further details.
>>>
>>> The FIXME in config/arm/arm_cmse.h is for a diagnostic message that is
>>> suggested in the ARMv8-M Security Extensions document mentioned above,
>>> to diagnose the use of the cmse_nonsecure_caller intrinsic outside of
>>> functions with the 'cmse_nonsecure_entry' attribute.  Checking whether
>>> the intrinsic is called from within such functions can easily be done
>>> inside 'arm_expand_builtin'. However, making the warning point to the
>>> right location is more complicated.  The ARMv8-M Security Extensions
>>> specification does mention that such a diagnostic might become
>>> mandatory, so I might have to pick this up later, otherwise it is left
>>> as a potential extra feature.
>>>
>>>
>>> *** gcc/ChangeLog ***
>>> 2016-07-25  Andre Vieira        <andre.simoesdiasvieira@arm.com>
>>>              Thomas Preud'homme  <thomas.preudhomme@arm.com>
>>>
>>>          * config/arm/arm-builtins.c (arm_builtins): Define
>>>          ARM_BUILTIN_CMSE_NONSECURE_CALLER.
>>>          (bdesc_2arg): Add line for cmse_nonsecure_caller.
>>>          (arm_expand_builtin): Handle cmse_nonsecure_caller.
>>>          * config/arm/arm_cmse.h (cmse_nonsecure_caller): New.
>>>
>>> *** gcc/testsuite/ChangeLog ***
>>> 2016-07-25  Andre Vieira        <andre.simoesdiasvieira@arm.com>
>>>              Thomas Preud'homme  <thomas.preudhomme@arm.com>
>>>
>>>          * gcc.target/arm/cmse/cmse-1.c: Add test for
>>>          cmse_nonsecure_caller.
>>>
>> Added more documentation as requested.
>>
>> ---
>>
>> This patch adds support ARMv8-M's Security Extension's
>> cmse_nonsecure_caller intrinsic. This intrinsic is used to check whether
>> an entry function was called from a non-secure state.
>> See Section 5.4.3 of ARM®v8-M Security Extensions: Requirements on
>> Development Tools
>> (http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/index.html)
>> for further details.
>>
>> The FIXME in config/arm/arm_cmse.h is for a diagnostic message that is
>> suggested in the ARMv8-M Security Extensions document mentioned above,
>> to diagnose the use of the cmse_nonsecure_caller intrinsic outside of
>> functions with the 'cmse_nonsecure_entry' attribute.  Checking whether
>> the intrinsic is called from within such functions can easily be done
>> inside 'arm_expand_builtin'. However, making the warning point to the
>> right location is more complicated.  The ARMv8-M Security Extensions
>> specification does mention that such a diagnostic might become
>> mandatory, so I might have to pick this up later, otherwise it is left
>> as a potential extra feature.
>>
>>
>> *** gcc/ChangeLog ***
>> 2016-07-xx  Andre Vieira        <andre.simoesdiasvieira@arm.com>
>>              Thomas Preud'homme  <thomas.preudhomme@arm.com>
>>
>>          * config/arm/arm-builtins.c (arm_builtins): Define
>>          ARM_BUILTIN_CMSE_NONSECURE_CALLER.
>>          (bdesc_2arg): Add line for cmse_nonsecure_caller.
>>          (arm_expand_builtin): Handle cmse_nonsecure_caller.
>>          * config/arm/arm_cmse.h (cmse_nonsecure_caller): New.
>>          * doc/extend.texi (ARM ARMv8-M Security Extensions): New intrinsic.
>>
>> *** gcc/testsuite/ChangeLog ***
>> 2016-07-xx  Andre Vieira        <andre.simoesdiasvieira@arm.com>
>>              Thomas Preud'homme  <thomas.preudhomme@arm.com>
>>
>>          * gcc.target/arm/cmse/cmse-1.c: Add test for
>>          cmse_nonsecure_caller.
>>
> Hi,
>
> Rebased previous patch on top of trunk as requested. No changes to
> ChangeLog.
>
> Cheers,
> Andre

@@ -1832,6 +1834,17 @@ arm_init_builtins (void)
  	= add_builtin_function ("__builtin_arm_stfscr", ftype_set_fpscr,
  				ARM_BUILTIN_SET_FPSCR, BUILT_IN_MD, NULL, NULL_TREE);
      }
+
+  if (arm_arch_cmse)
+    {
+      tree ftype_cmse_nonsecure_caller
+	= build_function_ty

Should this be use_cmse ?
This looks ok to me otherwise.
I believe patch [6/7] is the only one needing approval after this...

Kyrill



More information about the Gcc-patches mailing list