mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-11-16 04:24:43 +00:00
x86: PadLock adjustments
For one, all PadLock insns depend on CR4.FXSR to be enabled, which means they ought to be taking FXSR as a prereq. Furthermore none of them permits a REPNE prefix; such forms are documented to cause #UD. (This is mainly relevant for XSTORE, which doesn't include a REP prefix in its base encoding. For the others this merely is a change in what diagnostic is issued.) Finally it is documented that an operand size prefix also causes #UD.
This commit is contained in:
@@ -4899,11 +4899,6 @@ check_hle (void)
|
||||
switch (i.tm.opcode_modifier.prefixok)
|
||||
{
|
||||
default:
|
||||
abort ();
|
||||
case PrefixLock:
|
||||
case PrefixNone:
|
||||
case PrefixNoTrack:
|
||||
case PrefixRep:
|
||||
as_bad (_("invalid instruction `%s' after `%s'"),
|
||||
insn_name (&i.tm), i.hle_prefix);
|
||||
return 0;
|
||||
@@ -7372,7 +7367,9 @@ i386_assemble (char *line)
|
||||
return;
|
||||
|
||||
/* Check if REP prefix is OK. */
|
||||
if (i.rep_prefix && i.tm.opcode_modifier.prefixok != PrefixRep)
|
||||
if (i.rep_prefix && i.tm.opcode_modifier.prefixok != PrefixRep
|
||||
&& (i.prefix[REP_PREFIX] != REPE_PREFIX_OPCODE
|
||||
|| i.tm.opcode_modifier.prefixok != PrefixRepe))
|
||||
{
|
||||
as_bad (_("invalid instruction `%s' after `%s'"),
|
||||
insn_name (&i.tm), i.rep_prefix);
|
||||
@@ -7416,9 +7413,13 @@ i386_assemble (char *line)
|
||||
|
||||
if ((is_any_vex_encoding (&i.tm) && i.tm.opcode_space != SPACE_MAP4)
|
||||
|| i.tm.operand_types[i.imm_operands].bitfield.class >= RegMMX
|
||||
|| i.tm.operand_types[i.imm_operands + 1].bitfield.class >= RegMMX)
|
||||
|| i.tm.operand_types[i.imm_operands + 1].bitfield.class >= RegMMX
|
||||
/* (Ab)use the PrefixRepe attribute of PadLock insns as long as no
|
||||
others use it. */
|
||||
|| i.tm.opcode_modifier.prefixok == PrefixRepe)
|
||||
{
|
||||
/* Check for data size prefix on VEX/XOP/EVEX encoded and SIMD insns. */
|
||||
/* Check for data size prefix on VEX/XOP/EVEX encoded, SIMD, and
|
||||
PadLock insns. */
|
||||
if (i.prefix[DATA_PREFIX])
|
||||
{
|
||||
as_bad (_("data size prefix invalid with `%s'"), insn_name (&i.tm));
|
||||
|
||||
@@ -114,6 +114,7 @@ if [gas_32_check] then {
|
||||
run_dump_test "quoted2"
|
||||
run_dump_test "unary"
|
||||
run_dump_test "padlock"
|
||||
run_list_test "padlock-bad"
|
||||
run_dump_test "gmi"
|
||||
run_dump_test "padlockrng2"
|
||||
run_dump_test "padlockphe2"
|
||||
|
||||
5
gas/testsuite/gas/i386/padlock-bad.l
Normal file
5
gas/testsuite/gas/i386/padlock-bad.l
Normal file
@@ -0,0 +1,5 @@
|
||||
.* Assembler messages:
|
||||
.*:8: Error: invalid instruction `xstore' after `repne'
|
||||
.*:10: Error: data size prefix invalid with `xstore'
|
||||
.*:15: Error: invalid instruction `xsha1' after `repne'
|
||||
.*:17: Error: data size prefix invalid with `xsha1'
|
||||
17
gas/testsuite/gas/i386/padlock-bad.s
Normal file
17
gas/testsuite/gas/i386/padlock-bad.s
Normal file
@@ -0,0 +1,17 @@
|
||||
# VIA Nehemiah PadLock instructions w/ (problematic) prefixes
|
||||
|
||||
.text
|
||||
foo:
|
||||
xstore
|
||||
rep xstore
|
||||
repe xstore
|
||||
repne xstore
|
||||
|
||||
data16 xstore
|
||||
|
||||
xsha1
|
||||
rep xsha1
|
||||
repe xsha1
|
||||
repne xsha1
|
||||
|
||||
data16 xsha1
|
||||
Reference in New Issue
Block a user