[Fwd: lock xadd]

Angelo Fraietta angelo_f at bigpond.com
Fri Apr 25 08:49:19 UTC 2003



-------- Original Message --------
Subject: lock xadd
Date: Fri, 25 Apr 2003 08:18:40 -0000
From: "Adrian Bocaniciu" <a.bocaniciu at computer.org>
Reply-To: "Adrian Bocaniciu" <adrianb at alvarion.ro>
To: "Angelo Fraietta" <angelo_f at bigpond.com>
References: <3EA430C1.7070405 at OARcorp.com> 
<3EA4BB7D.8010007 at bigpond.com> <3EA569BB.142424AC at OARcorp.com> 
<3EA5C545.9040203 at bigpond.com> <3EA6914D.C1C1C02B at OARcorp.com> 
<3EA72F84.7040304 at bigpond.com> <3EA75B71.3020708 at bigpond.com> 
<3EA76E01.4000701 at bigpond.com> <3EA7E743.21FA20F0 at OARcorp.com> 
<3EA84987.9090602 at bigpond.com> <3EA84973.BC1C6C46 at OARcorp.com> 
<3EA863BD.2050504 at bigpond.com> <3EA89677.4080808 at bigpond.com>



--
> >
> In have done an objdump on my working exe and lock xadd is in quite a few
places.
>
> If I do an objdump on my exe built with gcc295, lock xadd is nowhere at
all.
>
> I did a search on google for lock xadd and in quite a few places it says
it is an illegal instruction. It is probably a GCC issue

    Hi Angelo,

"xadd", therefore also "lock xadd" is an instruction introduced by Intel
486.
It is illegal on i386-compatible processors.

Normally any program that uses "xadd" should have included in its
initialization
a test that the AC bit of the EFlags register can be flipped, since only
that
guarantees that the processor is i486-compatible and understands the "xadd"
instruction.

    If it is true that the offending program tries to execute "xadd", then
that
is the cause of the illegal instruction exception.

    However, it is not very clear why gcc would generate this instruction,
since it is used for manipulating objects like locks, mutexes or semaphores,
especially in multiprocessor environments, because it is an atomic
operation.

    Unfortunately, I do not have time now to search that code as I do not
have it
handy, but this seems to come from some inline assembly, so maybe a
recursive grep
through all the sources might find it.

                                                      Best regards !




-- 
Angelo Fraietta

PO Box 859
Hamilton NSW 2303

Home Page


http://www.users.bigpond.com/angelo_f/

There are those who seek knowledge for the sake of knowledge - that is CURIOSITY
There are those who seek knowledge to be known by others - that is VANITY
There are those who seek knowledge in order to serve - that is LOVE
    Bernard of Clairvaux (1090 - 1153)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20030425/7c88a9c8/attachment.html>


More information about the users mailing list