diff options
author | Maciej W. Rozycki <macro@imgtec.com> | 2017-06-30 07:21:55 +0100 |
---|---|---|
committer | Maciej W. Rozycki <macro@imgtec.com> | 2017-06-30 07:21:55 +0100 |
commit | 9785fc2a4d220322ce6cd1d79e768345ea5234d2 (patch) | |
tree | 275033dcff24aa9a5b87300fe32dbd8ca3936da2 /include/opcode | |
parent | 8d011e87dfa4e1719bd909b9adcbd1a0f5a75228 (diff) | |
download | binutils-gdb-9785fc2a4d220322ce6cd1d79e768345ea5234d2.tar.gz |
MIPS: Fix XPA base and Virtualization ASE instruction handling
Correct a commit 7d64c587c15f ("Add support for the MIPS eXtended
Physical Address (XPA) ASE.") bug, causing XPA base and Virtualization
ASE instructions to be wrongly always enabled with the selection of the
MIPS32r2 or higher ISA.
For example this source assembles successfully as shown below:
$ cat xpa.s
mfhc0 $2, $1
$ as -32 -mips32 -o xpa.o xpa.s
xpa.s: Assembler messages:
xpa.s:1: Error: opcode not supported on this processor: mips32 (mips32) `mfhc0 $2,$1'
$ as -32 -mips32r2 -o xpa.o xpa.s
$ objdump -d xpa.o
xpa.o: file format elf32-tradbigmips
Disassembly of section .text:
00000000 <.text>:
0: 40420800 mfhc0 v0,c0_random
...
$
To address this issue remove the I33 (INSN_ISA32R2) marking from all XPA
instructions in the opcode table. Additionally, for XPA Virtualization
ASE instructions implement an XPAVZ (ASE_XPA_VIRT) combination ASE flag
and use it in place of IVIRT|XPA (ASE_VIRT|ASE_XPA).
Now the same source is correctly rejected unless the `-mxpa' option is
also used:
$ as -32 -mips32r2 -o xpa.o xpa.s
xpa.s: Assembler messages:
xpa.s:1: Error: opcode not supported on this processor: mips32r2 (mips32r2) `mfhc0 $2,$1'
$ as -32 -mips32r2 -mxpa -o xpa.o xpa.s
$
Add test cases for XPA base and XPA Virtualization ASE instructions.
Parts of this change by Andrew Bennett.
include/
* opcode/mips.h (ASE_XPA_VIRT): New macro.
opcodes/
* mips-dis.c (mips_calculate_combination_ases): Handle the
ASE_XPA_VIRT flag.
(parse_mips_ase_option): New function.
(parse_mips_dis_option): Factor out ASE option handling to the
new function. Call `mips_calculate_combination_ases'.
* mips-opc.c (XPAVZ): New macro.
(mips_builtin_opcodes): Correct ISA and ASE flags for "mfhc0",
"mfhgc0", "mthc0" and "mthgc0".
gas/
* config/tc-mips.c (mips_set_ase): Handle the ASE_XPA_VIRT flag.
* testsuite/gas/mips/xpa.d: Remove `xpa' from `-M' in `objdump'
flags. Add `-mvirt' to `as' flags.
* testsuite/gas/mips/xpa-err.d: New test.
* testsuite/gas/mips/xpa-virt-err.d: New test.
* testsuite/gas/mips/xpa-err.l: New stderr output.
* testsuite/gas/mips/xpa-virt-err.l: New stderr output.
* testsuite/gas/mips/xpa-err.s: New test source.
* testsuite/gas/mips/xpa-virt-err.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.
binutils/
* testsuite/binutils-all/mips/mips-xpa-virt-1.d: New test.
* testsuite/binutils-all/mips/mips-xpa-virt-2.d: New test.
* testsuite/binutils-all/mips/mips-xpa-virt-3.d: New test.
* testsuite/binutils-all/mips/mips-xpa-virt-4.d: New test.
* testsuite/binutils-all/mips/mips-xpa-virt.s: New test source.
* testsuite/binutils-all/mips/mips.exp: Run the new tests.
Diffstat (limited to 'include/opcode')
-rw-r--r-- | include/opcode/mips.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/opcode/mips.h b/include/opcode/mips.h index 1b3b2c62f67..ceae9ec50a4 100644 --- a/include/opcode/mips.h +++ b/include/opcode/mips.h @@ -1291,6 +1291,9 @@ static const unsigned int mips_isa_table[] = { #define ASE_MIPS16E2 0x00008000 /* MIPS16e2 MT ASE instructions. */ #define ASE_MIPS16E2_MT 0x00010000 +/* The Virtualization ASE has eXtended Physical Addressing (XPA) + instructions which are only valid when both ASEs are enabled. */ +#define ASE_XPA_VIRT 0x00020000 /* MIPS ISA defines, use instead of hardcoding ISA level. */ |