diff options
author | Thomas Preud'homme <thomas.preudhomme@arm.com> | 2016-05-10 15:01:53 +0100 |
---|---|---|
committer | Thomas Preud'homme <thomas.preudhomme@arm.com> | 2016-05-10 15:03:38 +0100 |
commit | 16a1fa25be5705102b84ef0ea6eea71312328c2c (patch) | |
tree | 36e99bc00e549232c507b990e96535dd5c07f42b /gas | |
parent | 29f4fdc42db187300b208ba4310920bedb300a04 (diff) | |
download | gdb-16a1fa25be5705102b84ef0ea6eea71312328c2c.zip gdb-16a1fa25be5705102b84ef0ea6eea71312328c2c.tar.gz gdb-16a1fa25be5705102b84ef0ea6eea71312328c2c.tar.bz2 |
Add support for ARMv8-M security extensions instructions
2016-05-10 Thomas Preud'homme <thomas.preudhomme@arm.com>
gas/
* config/tc-arm.c (arm_ext_m): Add feature bit ARM_EXT2_V8M_MAIN.
(arm_ext_v8m_main): New feature set for bit ARM_EXT2_V8M_MAIN.
(arm_ext_v8m_m_only): New feature set for instructions in ARMv8-M not
shared with a non M profile architecture.
(do_rn): New function.
(known_t32_only_insn): Check opcode against arm_ext_v8m_m_only rather
than arm_ext_v8m.
(v7m_psrs): Add ARMv8-M security extensions new special registers.
(insns): Add ARMv8-M Security Extensions instructions.
(aeabi_set_public_attributes): Use arm_ext_v8m_m_only instead of
arm_ext_v8m_m to decide the profile and the Thumb ISA.
* testsuite/gas/arm/archv8m-cmse.s: New file.
* testsuite/gas/arm/archv8m-cmse-main.s: Likewise..
* testsuite/gas/arm/archv8m-cmse-msr.s: Likewise.
* testsuite/gas/arm/any-cmse.d: Likewise.
* testsuite/gas/arm/any-cmse-main.d: Likewise.
* testsuite/gas/arm/archv8m-cmse-base.d: Likewise.
* testsuite/gas/arm/archv8m-cmse-msr-base.d: Likewise.
* testsuite/gas/arm/archv8m-cmse-main-1.d: Likewise.
* testsuite/gas/arm/archv8m-cmse-main-2.d: Likewise.
* testsuite/gas/arm/archv8m-cmse-msr-main.d: Likewise.
include/
* opcode/arm.h (ARM_EXT2_V8M_MAIN): new feature bit.
(ARM_AEXT2_V8M_MAIN): New architecture extension feature set.
(ARM_ARCH_V8M_MAIN): Use ARM_AEXT2_V8M_MAIN instead of ARM_AEXT2_V8M
for the high core bits.
opcodes/
* arm-dis.c (coprocessor_opcodes): Add entries for VFP ARMv8-M
Mainline Security Extensions instructions.
(thumb_opcodes): Add entries for narrow ARMv8-M Security
Extensions instructions.
(thumb32_opcodes): Add entries for wide ARMv8-M Security Extensions
instructions.
(psr_name): Add new MSP_NS and PSP_NS ARMv8-M Security Extensions
special registers.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 24 | ||||
-rw-r--r-- | gas/config/tc-arm.c | 43 | ||||
-rw-r--r-- | gas/testsuite/gas/arm/any-cmse-main.d | 11 | ||||
-rw-r--r-- | gas/testsuite/gas/arm/any-cmse.d | 11 | ||||
-rw-r--r-- | gas/testsuite/gas/arm/archv8m-cmse-base.d | 17 | ||||
-rw-r--r-- | gas/testsuite/gas/arm/archv8m-cmse-main-1.d | 17 | ||||
-rw-r--r-- | gas/testsuite/gas/arm/archv8m-cmse-main-2.d | 10 | ||||
-rw-r--r-- | gas/testsuite/gas/arm/archv8m-cmse-main.s | 5 | ||||
-rw-r--r-- | gas/testsuite/gas/arm/archv8m-cmse-msr-base.d | 32 | ||||
-rw-r--r-- | gas/testsuite/gas/arm/archv8m-cmse-msr-main.d | 32 | ||||
-rw-r--r-- | gas/testsuite/gas/arm/archv8m-cmse-msr.s | 24 | ||||
-rw-r--r-- | gas/testsuite/gas/arm/archv8m-cmse.s | 12 |
12 files changed, 230 insertions, 8 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index edd2f2f..c13366e 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,27 @@ +2016-05-10 Thomas Preud'homme <thomas.preudhomme@arm.com> + + * config/tc-arm.c (arm_ext_m): Add feature bit ARM_EXT2_V8M_MAIN. + (arm_ext_v8m_main): New feature set for bit ARM_EXT2_V8M_MAIN. + (arm_ext_v8m_m_only): New feature set for instructions in ARMv8-M not + shared with a non M profile architecture. + (do_rn): New function. + (known_t32_only_insn): Check opcode against arm_ext_v8m_m_only rather + than arm_ext_v8m. + (v7m_psrs): Add ARMv8-M security extensions new special registers. + (insns): Add ARMv8-M Security Extensions instructions. + (aeabi_set_public_attributes): Use arm_ext_v8m_m_only instead of + arm_ext_v8m_m to decide the profile and the Thumb ISA. + * testsuite/gas/arm/archv8m-cmse.s: New file. + * testsuite/gas/arm/archv8m-cmse-main.s: Likewise.. + * testsuite/gas/arm/archv8m-cmse-msr.s: Likewise. + * testsuite/gas/arm/any-cmse.d: Likewise. + * testsuite/gas/arm/any-cmse-main.d: Likewise. + * testsuite/gas/arm/archv8m-cmse-base.d: Likewise. + * testsuite/gas/arm/archv8m-cmse-msr-base.d: Likewise. + * testsuite/gas/arm/archv8m-cmse-main-1.d: Likewise. + * testsuite/gas/arm/archv8m-cmse-main-2.d: Likewise. + * testsuite/gas/arm/archv8m-cmse-msr-main.d: Likewise. + 2016-05-09 Jose E. Marchesi <jose.marchesi@oracle.com> * testsuite/gas/sparc/sparc5vis4.s: Fix mnemonic of faligndatai. diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 6b004db..6a9d655 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -201,7 +201,8 @@ static const arm_feature_set arm_ext_v7r = ARM_FEATURE_CORE_LOW (ARM_EXT_V7R); static const arm_feature_set arm_ext_v7m = ARM_FEATURE_CORE_LOW (ARM_EXT_V7M); static const arm_feature_set arm_ext_v8 = ARM_FEATURE_CORE_LOW (ARM_EXT_V8); static const arm_feature_set arm_ext_m = - ARM_FEATURE_CORE (ARM_EXT_V6M | ARM_EXT_OS | ARM_EXT_V7M, ARM_EXT2_V8M); + ARM_FEATURE_CORE (ARM_EXT_V6M | ARM_EXT_OS | ARM_EXT_V7M, + ARM_EXT2_V8M | ARM_EXT2_V8M_MAIN); static const arm_feature_set arm_ext_mp = ARM_FEATURE_CORE_LOW (ARM_EXT_MP); static const arm_feature_set arm_ext_sec = ARM_FEATURE_CORE_LOW (ARM_EXT_SEC); static const arm_feature_set arm_ext_os = ARM_FEATURE_CORE_LOW (ARM_EXT_OS); @@ -209,6 +210,11 @@ static const arm_feature_set arm_ext_adiv = ARM_FEATURE_CORE_LOW (ARM_EXT_ADIV); static const arm_feature_set arm_ext_virt = ARM_FEATURE_CORE_LOW (ARM_EXT_VIRT); static const arm_feature_set arm_ext_pan = ARM_FEATURE_CORE_HIGH (ARM_EXT2_PAN); static const arm_feature_set arm_ext_v8m = ARM_FEATURE_CORE_HIGH (ARM_EXT2_V8M); +static const arm_feature_set arm_ext_v8m_main = + ARM_FEATURE_CORE_HIGH (ARM_EXT2_V8M_MAIN); +/* Instructions in ARMv8-M only found in M profile architectures. */ +static const arm_feature_set arm_ext_v8m_m_only = + ARM_FEATURE_CORE_HIGH (ARM_EXT2_V8M | ARM_EXT2_V8M_MAIN); static const arm_feature_set arm_ext_v6t2_v8m = ARM_FEATURE_CORE_HIGH (ARM_EXT2_V6T2_V8M); /* Instructions shared between ARMv8-A and ARMv8-M. */ @@ -8178,6 +8184,12 @@ do_rd (void) } static void +do_rn (void) +{ + inst.instruction |= inst.operands[0].reg << 16; +} + +static void do_rd_rm (void) { inst.instruction |= inst.operands[0].reg << 12; @@ -18189,8 +18201,8 @@ known_t32_only_insn (const struct asm_opcode *opcode) || ARM_CPU_HAS_FEATURE (*opcode->tvariant, arm_ext_barrier)) return TRUE; - /* Wide-only instruction added to ARMv8-M. */ - if (ARM_CPU_HAS_FEATURE (*opcode->tvariant, arm_ext_v8m) + /* Wide-only instruction added to ARMv8-M Baseline. */ + if (ARM_CPU_HAS_FEATURE (*opcode->tvariant, arm_ext_v8m_m_only) || ARM_CPU_HAS_FEATURE (*opcode->tvariant, arm_ext_atomics) || ARM_CPU_HAS_FEATURE (*opcode->tvariant, arm_ext_v6t2_v8m) || ARM_CPU_HAS_FEATURE (*opcode->tvariant, arm_ext_div)) @@ -18766,14 +18778,16 @@ static const struct asm_psr v7m_psrs[] = {"ipsr", 5 }, {"IPSR", 5 }, {"epsr", 6 }, {"EPSR", 6 }, {"iepsr", 7 }, {"IEPSR", 7 }, - {"msp", 8 }, {"MSP", 8 }, - {"psp", 9 }, {"PSP", 9 }, + {"msp", 8 }, {"MSP", 8 }, {"msp_s", 8 }, {"MSP_S", 8 }, + {"psp", 9 }, {"PSP", 9 }, {"psp_s", 9 }, {"PSP_S", 9 }, {"primask", 16}, {"PRIMASK", 16}, {"basepri", 17}, {"BASEPRI", 17}, {"basepri_max", 18}, {"BASEPRI_MAX", 18}, {"basepri_max", 18}, {"BASEPRI_MASK", 18}, /* Typo, preserved for backwards compatibility. */ {"faultmask", 19}, {"FAULTMASK", 19}, - {"control", 20}, {"CONTROL", 20} + {"control", 20}, {"CONTROL", 20}, + {"msp_ns", 0x88}, {"MSP_NS", 0x88}, + {"psp_ns", 0x89}, {"PSP_NS", 0x89} }; /* Table of all shift-in-operand names. */ @@ -20948,12 +20962,25 @@ static const struct asm_opcode insns[] = cCE("cfmadda32", e200600, 4, (RMAX, RMAX, RMFX, RMFX), mav_quad), cCE("cfmsuba32", e300600, 4, (RMAX, RMAX, RMFX, RMFX), mav_quad), + /* ARMv8-M instructions. */ #undef ARM_VARIANT #define ARM_VARIANT NULL #undef THUMB_VARIANT #define THUMB_VARIANT & arm_ext_v8m + TUE("sg", 0, e97fe97f, 0, (), 0, noargs), + TUE("blxns", 0, 4784, 1, (RRnpc), 0, t_blx), + TUE("bxns", 0, 4704, 1, (RRnpc), 0, t_bx), TUE("tt", 0, e840f000, 2, (RRnpc, RRnpc), 0, tt), TUE("ttt", 0, e840f040, 2, (RRnpc, RRnpc), 0, tt), + TUE("tta", 0, e840f080, 2, (RRnpc, RRnpc), 0, tt), + TUE("ttat", 0, e840f0c0, 2, (RRnpc, RRnpc), 0, tt), + + /* FP for ARMv8-M Mainline. Enabled for ARMv8-M Mainline because the + instructions behave as nop if no VFP is present. */ +#undef THUMB_VARIANT +#define THUMB_VARIANT & arm_ext_v8m_main + TUEc("vlldm", 0, ec300a00, 1, (RRnpc), rn), + TUEc("vlstm", 0, ec200a00, 1, (RRnpc), rn), }; #undef ARM_VARIANT #undef THUMB_VARIANT @@ -26171,7 +26198,7 @@ aeabi_set_public_attributes (void) if (ARM_CPU_HAS_FEATURE (flags, arm_ext_v7a) || ARM_CPU_HAS_FEATURE (flags, arm_ext_v8) || (ARM_CPU_HAS_FEATURE (flags, arm_ext_atomics) - && !ARM_CPU_HAS_FEATURE (flags, arm_ext_v8m))) + && !ARM_CPU_HAS_FEATURE (flags, arm_ext_v8m_m_only))) profile = 'A'; else if (ARM_CPU_HAS_FEATURE (flags, arm_ext_v7r)) profile = 'R'; @@ -26195,7 +26222,7 @@ aeabi_set_public_attributes (void) int thumb_isa_use; if (!ARM_CPU_HAS_FEATURE (flags, arm_ext_v8) - && ARM_CPU_HAS_FEATURE (flags, arm_ext_v8m)) + && ARM_CPU_HAS_FEATURE (flags, arm_ext_v8m_m_only)) thumb_isa_use = 3; else if (ARM_CPU_HAS_FEATURE (flags, arm_arch_t2)) thumb_isa_use = 2; diff --git a/gas/testsuite/gas/arm/any-cmse-main.d b/gas/testsuite/gas/arm/any-cmse-main.d new file mode 100644 index 0000000..be1535f --- /dev/null +++ b/gas/testsuite/gas/arm/any-cmse-main.d @@ -0,0 +1,11 @@ +#name: attributes for 'any' CPU with ARMv8-M Mainline Security Extensions instructions +#source: archv8m-cmse-main.s +#as: +#readelf: -A +# target: *-*-*eabi* *-*-nacl* + +Attribute Section: aeabi +File Attributes + Tag_CPU_arch: v8-M.mainline + Tag_CPU_arch_profile: Microcontroller + Tag_THUMB_ISA_use: Yes diff --git a/gas/testsuite/gas/arm/any-cmse.d b/gas/testsuite/gas/arm/any-cmse.d new file mode 100644 index 0000000..2d5aa85 --- /dev/null +++ b/gas/testsuite/gas/arm/any-cmse.d @@ -0,0 +1,11 @@ +#name: attributes for 'any' CPU with ARMv8-M Security Extensions instructions +#source: archv8m-cmse.s +#as: +#readelf: -A +# target: *-*-*eabi* *-*-nacl* + +Attribute Section: aeabi +File Attributes + Tag_CPU_arch: v8-M.baseline + Tag_CPU_arch_profile: Microcontroller + Tag_THUMB_ISA_use: Yes diff --git a/gas/testsuite/gas/arm/archv8m-cmse-base.d b/gas/testsuite/gas/arm/archv8m-cmse-base.d new file mode 100644 index 0000000..d8e4d33 --- /dev/null +++ b/gas/testsuite/gas/arm/archv8m-cmse-base.d @@ -0,0 +1,17 @@ +#name: ARMv8-M Baseline Security Extensions instructions +#source: archv8m-cmse.s +#as: -march=armv8-m.base +#objdump: -dr --prefix-addresses --show-raw-insn + +.*: +file format .*arm.* + +Disassembly of section .text: +0+.* <[^>]*> e97f e97f sg +0+.* <[^>]*> 47a4 blxns r4 +0+.* <[^>]*> 47cc blxns r9 +0+.* <[^>]*> 4724 bxns r4 +0+.* <[^>]*> 474c bxns r9 +0+.* <[^>]*> e841 f080 tta r0, r1 +0+.* <[^>]*> e849 f880 tta r8, r9 +0+.* <[^>]*> e841 f0c0 ttat r0, r1 +0+.* <[^>]*> e849 f8c0 ttat r8, r9 diff --git a/gas/testsuite/gas/arm/archv8m-cmse-main-1.d b/gas/testsuite/gas/arm/archv8m-cmse-main-1.d new file mode 100644 index 0000000..ef247c5 --- /dev/null +++ b/gas/testsuite/gas/arm/archv8m-cmse-main-1.d @@ -0,0 +1,17 @@ +#name: ARMv8-M Mainline Security Extensions instructions (1) +#source: archv8m-cmse.s +#as: -march=armv8-m.main +#objdump: -dr --prefix-addresses --show-raw-insn + +.*: +file format .*arm.* + +Disassembly of section .text: +0+.* <[^>]*> e97f e97f sg +0+.* <[^>]*> 47a4 blxns r4 +0+.* <[^>]*> 47cc blxns r9 +0+.* <[^>]*> 4724 bxns r4 +0+.* <[^>]*> 474c bxns r9 +0+.* <[^>]*> e841 f080 tta r0, r1 +0+.* <[^>]*> e849 f880 tta r8, r9 +0+.* <[^>]*> e841 f0c0 ttat r0, r1 +0+.* <[^>]*> e849 f8c0 ttat r8, r9 diff --git a/gas/testsuite/gas/arm/archv8m-cmse-main-2.d b/gas/testsuite/gas/arm/archv8m-cmse-main-2.d new file mode 100644 index 0000000..ad90766 --- /dev/null +++ b/gas/testsuite/gas/arm/archv8m-cmse-main-2.d @@ -0,0 +1,10 @@ +#name: ARMv8-M Mainline Security Extensions instructions (2) +#source: archv8m-cmse-main.s +#as: -march=armv8-m.main +#objdump: -dr --prefix-addresses --show-raw-insn + +.*: +file format .*arm.* + +Disassembly of section .text: +0+.* <[^>]*> ec31 0a00 vlldm r1 +0+.* <[^>]*> ec22 0a00 vlstm r2 diff --git a/gas/testsuite/gas/arm/archv8m-cmse-main.s b/gas/testsuite/gas/arm/archv8m-cmse-main.s new file mode 100644 index 0000000..069cad6 --- /dev/null +++ b/gas/testsuite/gas/arm/archv8m-cmse-main.s @@ -0,0 +1,5 @@ +.thumb +.syntax unified + +vlldm r1 +vlstm r2 diff --git a/gas/testsuite/gas/arm/archv8m-cmse-msr-base.d b/gas/testsuite/gas/arm/archv8m-cmse-msr-base.d new file mode 100644 index 0000000..8377677 --- /dev/null +++ b/gas/testsuite/gas/arm/archv8m-cmse-msr-base.d @@ -0,0 +1,32 @@ +#name: ARMv8-M Baseline Security Extensions MSR/MRS instructions +#source: archv8m-cmse-msr.s +#as: -march=armv8-m.base +#objdump: -dr --prefix-addresses --show-raw-insn + +.*: +file format .*arm.* + +Disassembly of section .text: +0+.* <[^>]*> f380 8808 msr MSP, r0 +0+.* <[^>]*> f380 8808 msr MSP, r0 +0+.* <[^>]*> f380 8888 msr MSP_NS, r0 +0+.* <[^>]*> f380 8809 msr PSP, r0 +0+.* <[^>]*> f380 8809 msr PSP, r0 +0+.* <[^>]*> f380 8889 msr PSP_NS, r0 +0+.* <[^>]*> f380 8808 msr MSP, r0 +0+.* <[^>]*> f380 8808 msr MSP, r0 +0+.* <[^>]*> f380 8888 msr MSP_NS, r0 +0+.* <[^>]*> f380 8809 msr PSP, r0 +0+.* <[^>]*> f380 8809 msr PSP, r0 +0+.* <[^>]*> f380 8889 msr PSP_NS, r0 +0+.* <[^>]*> f3ef 8008 mrs r0, MSP +0+.* <[^>]*> f3ef 8008 mrs r0, MSP +0+.* <[^>]*> f3ef 8088 mrs r0, MSP_NS +0+.* <[^>]*> f3ef 8009 mrs r0, PSP +0+.* <[^>]*> f3ef 8009 mrs r0, PSP +0+.* <[^>]*> f3ef 8089 mrs r0, PSP_NS +0+.* <[^>]*> f3ef 8008 mrs r0, MSP +0+.* <[^>]*> f3ef 8008 mrs r0, MSP +0+.* <[^>]*> f3ef 8088 mrs r0, MSP_NS +0+.* <[^>]*> f3ef 8009 mrs r0, PSP +0+.* <[^>]*> f3ef 8009 mrs r0, PSP +0+.* <[^>]*> f3ef 8089 mrs r0, PSP_NS diff --git a/gas/testsuite/gas/arm/archv8m-cmse-msr-main.d b/gas/testsuite/gas/arm/archv8m-cmse-msr-main.d new file mode 100644 index 0000000..ca8b000 --- /dev/null +++ b/gas/testsuite/gas/arm/archv8m-cmse-msr-main.d @@ -0,0 +1,32 @@ +#name: ARMv8-M Mainline Security Extensions MSR/MRS instructions +#source: archv8m-cmse-msr.s +#as: -march=armv8-m.main +#objdump: -dr --prefix-addresses --show-raw-insn + +.*: +file format .*arm.* + +Disassembly of section .text: +0+.* <[^>]*> f380 8808 msr MSP, r0 +0+.* <[^>]*> f380 8808 msr MSP, r0 +0+.* <[^>]*> f380 8888 msr MSP_NS, r0 +0+.* <[^>]*> f380 8809 msr PSP, r0 +0+.* <[^>]*> f380 8809 msr PSP, r0 +0+.* <[^>]*> f380 8889 msr PSP_NS, r0 +0+.* <[^>]*> f380 8808 msr MSP, r0 +0+.* <[^>]*> f380 8808 msr MSP, r0 +0+.* <[^>]*> f380 8888 msr MSP_NS, r0 +0+.* <[^>]*> f380 8809 msr PSP, r0 +0+.* <[^>]*> f380 8809 msr PSP, r0 +0+.* <[^>]*> f380 8889 msr PSP_NS, r0 +0+.* <[^>]*> f3ef 8008 mrs r0, MSP +0+.* <[^>]*> f3ef 8008 mrs r0, MSP +0+.* <[^>]*> f3ef 8088 mrs r0, MSP_NS +0+.* <[^>]*> f3ef 8009 mrs r0, PSP +0+.* <[^>]*> f3ef 8009 mrs r0, PSP +0+.* <[^>]*> f3ef 8089 mrs r0, PSP_NS +0+.* <[^>]*> f3ef 8008 mrs r0, MSP +0+.* <[^>]*> f3ef 8008 mrs r0, MSP +0+.* <[^>]*> f3ef 8088 mrs r0, MSP_NS +0+.* <[^>]*> f3ef 8009 mrs r0, PSP +0+.* <[^>]*> f3ef 8009 mrs r0, PSP +0+.* <[^>]*> f3ef 8089 mrs r0, PSP_NS diff --git a/gas/testsuite/gas/arm/archv8m-cmse-msr.s b/gas/testsuite/gas/arm/archv8m-cmse-msr.s new file mode 100644 index 0000000..4a61761 --- /dev/null +++ b/gas/testsuite/gas/arm/archv8m-cmse-msr.s @@ -0,0 +1,24 @@ +msr MSP, r0 +msr MSP_S, r0 +msr MSP_NS, r0 +msr PSP, r0 +msr PSP_S, r0 +msr PSP_NS, r0 +msr msp, r0 +msr msp_s, r0 +msr msp_ns, r0 +msr psp, r0 +msr psp_s, r0 +msr psp_ns, r0 +mrs r0, MSP +mrs r0, MSP_S +mrs r0, MSP_NS +mrs r0, PSP +mrs r0, PSP_S +mrs r0, PSP_NS +mrs r0, msp +mrs r0, msp_s +mrs r0, msp_ns +mrs r0, psp +mrs r0, psp_s +mrs r0, psp_ns diff --git a/gas/testsuite/gas/arm/archv8m-cmse.s b/gas/testsuite/gas/arm/archv8m-cmse.s new file mode 100644 index 0000000..520550c --- /dev/null +++ b/gas/testsuite/gas/arm/archv8m-cmse.s @@ -0,0 +1,12 @@ +.thumb +.syntax unified + +sg +blxns r4 +blxns r9 +bxns r4 +bxns r9 +tta r0, r1 +tta r8, r9 +ttat r0, r1 +ttat r8, r9 |