This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: An ia32 LOCK/XADD bug.
- To: "H . J . Lu" <hjl at lucon dot org>
- Subject: Re: An ia32 LOCK/XADD bug.
- From: Ulrich Drepper <drepper at redhat dot com>
- Date: 17 May 2001 00:30:07 -0700
- Cc: GNU C Library <libc-alpha at sourceware dot cygnus dot com>, binutils at sourceware dot cygnus dot com
- References: <20010516125536.A6006@lucon.org> <20010517001556.B16213@lucon.org>
- Reply-To: drepper at cygnus dot com (Ulrich Drepper)
"H . J . Lu" <hjl@lucon.org> writes:
> is an illegal instruction on ia32. I cannot find anything in Intel
> reference manual to say you cannot have LOCK on insn where DST/SRC are
> reg or same. My questions are
It is definitely illegal. The lock prefix works on the part of the
processor which handles memory access.
The problem I have is to see where you actually find this code in glibc.
> 1. How to write a correct exchange_and_add? Is exchange_and_add_1 ok?
This is exactly what we do in sysdeps/i386/i486/atomicity.h.
> 2. If "lock xadd %edx,%edx" is really an illegal instruction on ia32,
> how should we fix gas to detect that?
Some IA-32 specific code has to check that an instruction with a lock
prefix always has a memory operand. Don't know where to insert this.
--
---------------. ,-. 1325 Chesapeake Terrace
Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA
Red Hat `--' drepper at redhat.com `------------------------