This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCHv2 6/7, GCC, ARM, V8M] ARMv8-M Security Extension's cmse_nonsecure_call: use __gnu_cmse_nonsecure_call


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:26, Andre Vieira (lists) wrote:
>>> This patch extends support for the ARMv8-M Security Extensions
>>> 'cmse_nonsecure_call' to use a new library function
>>> '__gnu_cmse_nonsecure_call'. This library function is responsible for
>>> (without using r0-r3 or d0-d7):
>>> 1) saving and clearing all callee-saved registers using the secure stack
>>> 2) clearing the LSB of the address passed in r4 and using blxns to
>>> 'jump' to it
>>> 3) clearing ASPR, including the 'ge bits' if DSP is enabled
>>> 4) clearing FPSCR if using non-soft float-abi
>>> 5) restoring callee-saved registers.
>>>
>>> The decisions whether to include DSP 'ge bits' clearing and floating
>>> point registers (single/double precision) all depends on the multilib used.
>>>
>>> See Section 5.5 of ARM®v8-M Security Extensions
>>> (http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/index.html).
>>>
>>> *** gcc/ChangeLog ***
>>> 2016-07-25  Andre Vieira        <andre.simoesdiasvieira@arm.com>
>>>             Thomas Preud'homme  <thomas.preudhomme@arm.com>
>>>
>>>         * config/arm/arm.c (detect_cmse_nonsecure_call): New.
>>>         (cmse_nonsecure_call_clear_caller_saved): New.
>>>         (arm_reorg): Use cmse_nonsecure_call_clear_caller_saved.
>>>         * config/arm/arm-protos.h (detect_cmse_nonsecure_call): New.
>>>         * config/arm/arm.md (call): Handle cmse_nonsecure_entry.
>>>         (call_value): Likewise.
>>>         (nonsecure_call_internal): New.
>>>         (nonsecure_call_value_internal): New.
>>>         * config/arm/thumb1.md (*nonsecure_call_reg_thumb1_v5): New.
>>>         (*nonsecure_call_value_reg_thumb1_v5): New.
>>>         * config/arm/thumb2.md (*nonsecure_call_reg_thumb2): New.
>>>         (*nonsecure_call_value_reg_thumb2): New.
>>>         * config/arm/unspecs.md (UNSPEC_NONSECURE_MEM): New.
>>>
>>> *** libgcc/ChangeLog ***
>>> 2016-07-25  Andre Vieira        <andre.simoesdiasvieira@arm.com>
>>>             Thomas Preud'homme  <thomas.preudhomme@arm.com>
>>>
>>>         * config/arm/cmse_nonsecure_call.S: New.
>>> 	* config/arm/t-arm: Compile cmse_nonsecure_call.S
>>>
>>>
>>> *** gcc/testsuite/ChangeLog ***
>>> 2016-07-25  Andre Vieira        <andre.simoesdiasvieira@arm.com>
>>>             Thomas Preud'homme  <thomas.preudhomme@arm.com>
>>>
>>>         * gcc.target/arm/cmse/cmse.exp: Run tests in mainline dir.
>>>         * gcc.target/arm/cmse/cmse-9.c: Added some extra tests.
>>>         * gcc.target/arm/cmse/baseline/bitfield-4.c: New.
>>>         * gcc.target/arm/cmse/baseline/bitfield-5.c: New.
>>>         * gcc.target/arm/cmse/baseline/bitfield-6.c: New.
>>>         * gcc.target/arm/cmse/baseline/bitfield-7.c: New.
>>>         * gcc.target/arm/cmse/baseline/bitfield-8.c: New.
>>>         * gcc.target/arm/cmse/baseline/bitfield-9.c: New.
>>>         * gcc.target/arm/cmse/baseline/bitfield-and-union-1.c: New.
>>>         * gcc.target/arm/cmse/baseline/cmse-11.c: New.
>>> 	* gcc.target/arm/cmse/baseline/cmse-13.c: New.
>>> 	* gcc.target/arm/cmse/baseline/cmse-6.c: New.
>>>         * gcc/testsuite/gcc.target/arm/cmse/baseline/union-1.c: New.
>>>         * gcc/testsuite/gcc.target/arm/cmse/baseline/union-2.c: New.
>>> 	* gcc.target/arm/cmse/mainline/hard-sp/cmse-13.c: New.
>>> 	* gcc.target/arm/cmse/mainline/hard-sp/cmse-7.c: New.
>>> 	* gcc.target/arm/cmse/mainline/hard-sp/cmse-8.c: New.
>>> 	* gcc.target/arm/cmse/mainline/hard/cmse-13.c: New.
>>> 	* gcc.target/arm/cmse/mainline/hard/cmse-7.c: New.
>>> 	* gcc.target/arm/cmse/mainline/hard/cmse-8.c: New.
>>> 	* gcc.target/arm/cmse/mainline/soft/cmse-13.c: New.
>>> 	* gcc.target/arm/cmse/mainline/soft/cmse-7.c: New.
>>> 	* gcc.target/arm/cmse/mainline/soft/cmse-8.c: New.
>>> 	* gcc.target/arm/cmse/mainline/softfp-sp/cmse-7.c: New.
>>> 	* gcc.target/arm/cmse/mainline/softfp-sp/cmse-8.c: New.
>>> 	* gcc.target/arm/cmse/mainline/softfp/cmse-13.c: New.
>>> 	* gcc.target/arm/cmse/mainline/softfp/cmse-7.c: New.
>>> 	* gcc.target/arm/cmse/mainline/softfp/cmse-8.c: New.
>>>
>>
>> Updated this patch to correctly clear only the cumulative
>> exception-status (0-4,7) and the condition code bits (28-31) of the FPSCR.
>>
>> ----
>>
>> This patch extends support for the ARMv8-M Security Extensions
>> 'cmse_nonsecure_call' to use a new library function
>> '__gnu_cmse_nonsecure_call'. This library function is responsible for
>> (without using r0-r3 or d0-d7):
>> 1) saving and clearing all callee-saved registers using the secure stack
>> 2) clearing the LSB of the address passed in r4 and using blxns to
>> 'jump' to it
>> 3) clearing ASPR, including the 'ge bits' if DSP is enabled
>> 4) clearing the cumulative exception-status (0-4, 7) and the condition
>> bits (28-31) of the FPSCR if using non-soft float-abi
>> 5) restoring callee-saved registers.
>>
>> The decisions whether to include DSP 'ge bits' clearing and floating
>> point registers (single/double precision) all depends on the multilib used.
>>
>> See Section 5.5 of ARM®v8-M Security Extensions
>> (http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/index.html).
>>
>> *** gcc/ChangeLog ***
>> 2016-07-xx  Andre Vieira        <andre.simoesdiasvieira@arm.com>
>>             Thomas Preud'homme  <thomas.preudhomme@arm.com>
>>
>>         * config/arm/arm.c (detect_cmse_nonsecure_call): New.
>>         (cmse_nonsecure_call_clear_caller_saved): New.
>>         (arm_reorg): Use cmse_nonsecure_call_clear_caller_saved.
>>         * config/arm/arm-protos.h (detect_cmse_nonsecure_call): New.
>>         * config/arm/arm.md (call): Handle cmse_nonsecure_entry.
>>         (call_value): Likewise.
>>         (nonsecure_call_internal): New.
>>         (nonsecure_call_value_internal): New.
>>         * config/arm/thumb1.md (*nonsecure_call_reg_thumb1_v5): New.
>>         (*nonsecure_call_value_reg_thumb1_v5): New.
>>         * config/arm/thumb2.md (*nonsecure_call_reg_thumb2): New.
>>         (*nonsecure_call_value_reg_thumb2): New.
>>         * config/arm/unspecs.md (UNSPEC_NONSECURE_MEM): New.
>>
>> *** libgcc/ChangeLog ***
>> 2016-07-xx  Andre Vieira        <andre.simoesdiasvieira@arm.com>
>>             Thomas Preud'homme  <thomas.preudhomme@arm.com>
>>
>>         * config/arm/cmse_nonsecure_call.S: New.
>> 	* config/arm/t-arm: Compile cmse_nonsecure_call.S
>>
>>
>> *** gcc/testsuite/ChangeLog ***
>> 2016-07-xx  Andre Vieira        <andre.simoesdiasvieira@arm.com>
>>             Thomas Preud'homme  <thomas.preudhomme@arm.com>
>>
>>         * gcc.target/arm/cmse/cmse.exp: Run tests in mainline dir.
>>         * gcc.target/arm/cmse/cmse-9.c: Added some extra tests.
>>         * gcc.target/arm/cmse/baseline/bitfield-4.c: New.
>>         * gcc.target/arm/cmse/baseline/bitfield-5.c: New.
>>         * gcc.target/arm/cmse/baseline/bitfield-6.c: New.
>>         * gcc.target/arm/cmse/baseline/bitfield-7.c: New.
>>         * gcc.target/arm/cmse/baseline/bitfield-8.c: New.
>>         * gcc.target/arm/cmse/baseline/bitfield-9.c: New.
>>         * gcc.target/arm/cmse/baseline/bitfield-and-union-1.c: New.
>>         * gcc.target/arm/cmse/baseline/cmse-11.c: New.
>> 	* gcc.target/arm/cmse/baseline/cmse-13.c: New.
>> 	* gcc.target/arm/cmse/baseline/cmse-6.c: New.
>>         * gcc/testsuite/gcc.target/arm/cmse/baseline/union-1.c: New.
>>         * gcc/testsuite/gcc.target/arm/cmse/baseline/union-2.c: New.
>> 	* gcc.target/arm/cmse/mainline/hard-sp/cmse-13.c: New.
>> 	* gcc.target/arm/cmse/mainline/hard-sp/cmse-7.c: New.
>> 	* gcc.target/arm/cmse/mainline/hard-sp/cmse-8.c: New.
>> 	* gcc.target/arm/cmse/mainline/hard/cmse-13.c: New.
>> 	* gcc.target/arm/cmse/mainline/hard/cmse-7.c: New.
>> 	* gcc.target/arm/cmse/mainline/hard/cmse-8.c: New.
>> 	* gcc.target/arm/cmse/mainline/soft/cmse-13.c: New.
>> 	* gcc.target/arm/cmse/mainline/soft/cmse-7.c: New.
>> 	* gcc.target/arm/cmse/mainline/soft/cmse-8.c: New.
>> 	* gcc.target/arm/cmse/mainline/softfp-sp/cmse-7.c: New.
>> 	* gcc.target/arm/cmse/mainline/softfp-sp/cmse-8.c: New.
>> 	* gcc.target/arm/cmse/mainline/softfp/cmse-13.c: New.
>> 	* gcc.target/arm/cmse/mainline/softfp/cmse-7.c: New.
>> 	* gcc.target/arm/cmse/mainline/softfp/cmse-8.c: New.
>>
> Hi,
> 
> Rebased previous patch on top of trunk as requested. No changes to
> ChangeLog.
> 
> Cheers,
> Andre
> 

Hi,

Reworked the testcase for compiling without -mcmse to catch the warning
added in 5/7. Also took the opportunity to improve the code in the
cmse_nonsecure_call library wrapper.

Cheers,
Andre

Attachment: diff6
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]