Re: __asm__ cmpxchg8b/cmpxchg16b



anthony.ajw@xxxxxxxxx wrote:
Toby Douglass <a@xxxxx> writes:

It does tell you reliably! It tells you exactly what the old value was
when the CAS executed. It does not tell you what the value is now (you'd
have to read it again to find out).

Yes - from one point of view, single threaded assembley, it tells you
reliably. The value is in the register and the correct value was placed
there, always.

From my point of view as a C programmer in a multi-threaded environment,
it does not tell me reliably, because I cannot reliably get at that
information.

However, in other cases, where you're swapping pointers around,
using
the wrong value is not interesting in any way; it's fatal.

It depends what you do with the pointers. If you dereference them, and
don't have a means of ensuring that they are still valid then it's
fatal. If you're just using them for comparisons, or you do have a
lifetime-management scheme in place so they are safe for dereferencing
then it's fine.

Yes.
.



Relevant Pages

  • Re: I need references about hooking
    ... OS is updating storage, it is doing it in a safe manner, eg, ensuring ... hooking introduces instability and unpredictability. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Acronis software
    ... Acronis Privacy Expert Suite 8.0 gives you all the security you need, ensuring that all the information on your PC remains safe. ...
    (uk.comp.misc)
  • Re: NOC password management
    ... Firstly common to all solutions is ensuring: ... I've seen paper based solutions where all passwords are stored in a ... safe, each in tamper evident envelopes and written down. ... What are the best practices for enterprise password management? ...
    (Security-Basics)
  • Re: returning address of a local variable
    ... it's perfectly safe as long as you don't use it. ... variable could be deallocated from memory and the dereferencing of the ... strtok() modifies the string you pass to it. ...
    (comp.lang.c)
  • Re: Safe use of modf( )
    ... Just wondering if this is safe to do: ... store intermediate results by dereferencing the second argument, ... Remove del for email ...
    (microsoft.public.vc.language)