aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-i386.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2009-11-14 06:04:34 +0000
committerH.J. Lu <hjl.tools@gmail.com>2009-11-14 06:04:34 +0000
commitc1ba026631b21acbb0cf32e36fa7130df3cc6eee (patch)
tree5b1e28b4bc59016a6c1df1ca8c8d8905dd1bd7eb /gas/config/tc-i386.c
parent68a3e151dab3d8be31eb5347e10db53daba25e2a (diff)
downloadgdb-c1ba026631b21acbb0cf32e36fa7130df3cc6eee.zip
gdb-c1ba026631b21acbb0cf32e36fa7130df3cc6eee.tar.gz
gdb-c1ba026631b21acbb0cf32e36fa7130df3cc6eee.tar.bz2
Check destination operand for lockable instructions.
gas/ 2009-11-13 H.J. Lu <hongjiu.lu@intel.com> * config/tc-i386.c (md_assemble): Check destination operand for lockable instructions. gas/testsuite/ 2009-11-13 H.J. Lu <hongjiu.lu@intel.com> * gas/i386/lock-1-intel.d: Updated. * gas/i386/lock-1.d: Likewise. * gas/i386/lock-1.s: Likewise. * gas/i386/lockbad-1.l: Likewise. * gas/i386/lockbad-1.s: Likewise. * gas/i386/x86-64-lock-1-intel.d: Likewise. * gas/i386/x86-64-lock-1.d: Likewise. * gas/i386/x86-64-lock-1.s: Likewise. * gas/i386/x86-64-lockbad-1.l: Likewise. * gas/i386/x86-64-lockbad-1.s: Likewise.
Diffstat (limited to 'gas/config/tc-i386.c')
-rw-r--r--gas/config/tc-i386.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 6aa9949..8a67797 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -2932,10 +2932,13 @@ md_assemble (char *line)
if (!add_prefix (FWAIT_OPCODE))
return;
- /* Check for lock without a lockable instruction. */
+ /* Check for lock without a lockable instruction. Destination operand
+ must be memory unless it is xchg (0x86). */
if (i.prefix[LOCK_PREFIX]
&& (!i.tm.opcode_modifier.islockable
- || i.mem_operands == 0))
+ || i.mem_operands == 0
+ || (i.tm.base_opcode != 0x86
+ && !operand_type_check (i.types[i.operands - 1], anymem))))
{
as_bad (_("expecting lockable instruction after `lock'"));
return;