binutils-gdb/include/opcode
Maciej W. Rozycki 9785fc2a4d MIPS: Fix XPA base and Virtualization ASE instruction handling
Correct a commit 7d64c587c1 ("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.
2017-06-30 07:21:55 +01:00
..
ChangeLog-0415 binutils ChangeLog rotation 2016-01-01 22:59:17 +10:30
ChangeLog-9103 Add copyright notices 2012-12-10 12:48:03 +00:00
aarch64.h [AArch64] Add dot product support for AArch64 to binutils 2017-06-28 11:09:01 +01:00
alpha.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
arc-attrs.h [ARC] Object attributes. 2017-05-10 14:42:22 +02:00
arc-func.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
arc.h [ARC] Update MAX_INSN_FLGS. 2017-05-23 12:18:10 +02:00
arm.h [ARM] Assembler and disassembler support Dot Product Extension 2017-06-28 11:00:55 +01:00
avr.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
bfin.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
cgen.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
convex.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
cr16.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
cris.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
crx.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
d10v.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
d30v.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
dlx.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
ft32.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
h8300.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
hppa.h Fix match and mask for 64-bit bb opcode. 2017-05-14 16:06:06 -04:00
i370.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
i386.h x86: Add NOTRACK prefix support 2017-05-22 11:02:58 -07:00
i860.h Clarify that include/opcode/ files are part of GNU opcodes 2017-01-25 12:30:52 +00:00
i960.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
ia64.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
m68hc11.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
m68k.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
m88k.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
metag.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
mips.h MIPS: Fix XPA base and Virtualization ASE instruction handling 2017-06-30 07:21:55 +01:00
mmix.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
mn10200.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
mn10300.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
moxie.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
msp430-decode.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
msp430.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
nds32.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
nios2.h Clarify that include/opcode/ files are part of GNU opcodes 2017-01-25 12:30:52 +00:00
nios2r1.h Clarify that include/opcode/ files are part of GNU opcodes 2017-01-25 12:30:52 +00:00
nios2r2.h Clarify that include/opcode/ files are part of GNU opcodes 2017-01-25 12:30:52 +00:00
np1.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
ns32k.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
pdp11.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
pj.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
pn.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
ppc.h Reorder PPC_OPCODE_* and set PPC_OPCODE_TMR for e6500 2017-04-11 07:43:21 +09:30
pru.h Clarify that include/opcode/ files are part of GNU opcodes 2017-01-25 12:30:52 +00:00
pyr.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
riscv-opc.h RISC-V: Add physical memory protection CSRs 2017-03-31 09:35:11 -07:00
riscv.h Add support for the Q extension to the RISCV ISA. 2017-01-03 17:42:01 +00:00
rl78.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
rx.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
s390.h S/390: Improve error checking for optional operands 2017-05-30 10:22:25 +02:00
score-datadep.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
score-inst.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
sparc.h binutils: support for the SPARC M8 processor 2017-05-19 09:27:08 -07:00
spu-insns.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
spu.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
tahoe.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
tic4x.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
tic6x-control-registers.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
tic6x-insn-formats.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
tic6x-opcode-table.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
tic6x.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
tic30.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
tic54x.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
tic80.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
tilegx.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
tilepro.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
v850.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
vax.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
visium.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
wasm.h Add support for the WebAssembly file format and the wasm32 ELF conversion to gas and the binutils. 2017-03-30 10:57:21 +01:00
xgate.h Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30