This fixes a bug in the ARm assembler where an immediate operand larger than 4 bits...
authorBarnaby Wilk s <barnaby.wilks@arm.com>
Thu, 27 Jun 2019 13:06:02 +0000 (14:06 +0100)
committerNick Clifton <nickc@redhat.com>
Thu, 27 Jun 2019 13:06:02 +0000 (14:06 +0100)
commitba85f98c42877287f45644a6d75513239c9490a5
tree4b99cd21520a8c6a56fa4ba4e4fbe4e25d36dfe9
parent5ceb1f4d804b09cb8767ca704c2ba41e50a2bcdb
This fixes a bug in the ARm assembler where an immediate operand larger than 4 bits (0xF) could be passed to the SMC (Secure Monitor Call) instruction.

For example, this code is invalid:
smc #0x6951

The code would previously check for and encode for up to 16 bit immediate values, however
this immediate should instead be only a 4 bit value
(as documented herehttps://static.docs.arm.com/ddi0406/c/DDI0406C_C_arm_architecture_reference_manual.pdf  ).

Fixed this by adding range checks in the relevant areas and also removing code that would
encode more than the first 4 bits of the immediate (code that is now redundant, as any immediate operand
larger than 0xF would error now anyway).

gas * config/tc-arm.c (do_smc): Add range check for immediate operand.
(do_t_smc): Add range check for immediate operand. Remove
obsolete immediate encoding.
(md_apply_fix): Fix range check. Remove obsolete immediate encoding.
* testsuite/gas/arm/arch6zk.d: Fix test.
* testsuite/gas/arm/arch6zk.s: Fix test.
* testsuite/gas/arm/smc-bad.d: New test.
* testsuite/gas/arm/smc-bad.l: New test.
* testsuite/gas/arm/smc-bad.s: New test.
* testsuite/gas/arm/thumb32.d: Fix test.
* testsuite/gas/arm/thumb32.s: Fix test.
gas/ChangeLog
gas/config/tc-arm.c
gas/testsuite/gas/arm/arch6zk.d
gas/testsuite/gas/arm/arch6zk.s
gas/testsuite/gas/arm/smc-bad.d [new file with mode: 0644]
gas/testsuite/gas/arm/smc-bad.l [new file with mode: 0644]
gas/testsuite/gas/arm/smc-bad.s [new file with mode: 0644]
gas/testsuite/gas/arm/thumb32.d
gas/testsuite/gas/arm/thumb32.s
This page took 0.027091 seconds and 4 git commands to generate.