rattusdatorum
November 17th, 2005, 09:40 AM
Hi!
I am trying to implement a semaphore, well the problem is the inline assembly of gcc doesn't recognize the "lock" command, which is needed prior to cmpxchg to make cmpxchg atomic :(
I am not quite sure why it doesn't works, could it be that it doesn't works because ubuntu uses a 386 architecture and the "lock" command was first used on the
486 architecture?
btw. as (gnu assembly compiler) has the same problem:
cmpxchg.s:6: Error: suffix or operands invalid for `cmpxchg'
if my assumptions is correct is there a way to get "lock" work and how?
if I am wrong, whats the real cause for my problem?
thx in advance
I am trying to implement a semaphore, well the problem is the inline assembly of gcc doesn't recognize the "lock" command, which is needed prior to cmpxchg to make cmpxchg atomic :(
I am not quite sure why it doesn't works, could it be that it doesn't works because ubuntu uses a 386 architecture and the "lock" command was first used on the
486 architecture?
btw. as (gnu assembly compiler) has the same problem:
cmpxchg.s:6: Error: suffix or operands invalid for `cmpxchg'
if my assumptions is correct is there a way to get "lock" work and how?
if I am wrong, whats the real cause for my problem?
thx in advance