Interlocked...() on MP

I need to see the disassembly for one of the “Interlocked” functions on a
multiprocessor kernel. InterlockedIncrement() should be fine. Unfortunately, I
don’t have ready debugging access to an MP machine at this moment. I’ve
extended the “Interlocked” functions for my own use to fill some holes in the
API set and I need to check on an MP-related issue. I’d really appreciate it if
someone could pop into a debugger and post the dump of one of these babies for
me.

Sincerely,

Chris Myers
Senior Project Engineer
Quatech, Inc.

Don’t they just use the LOCK opcode of the x86 ?

Regards

Paul Bunn, UltraBac Software, 425-644-6000
Microsoft MVP - NT/Windows 2000/XP
http://www.ultrabac.com

-----Original Message-----
From: Chris Myers [mailto:xxxxx@quatech.com]
Sent: Wednesday, May 08, 2002 8:07 AM
To: NT Developers Interest List
Subject: [ntdev] Interlocked…() on MP

I need to see the disassembly for one of the “Interlocked” functions on a
multiprocessor kernel. InterlockedIncrement() should be fine. Unfortunately, I
don’t have ready debugging access to an MP machine at this moment. I’ve
extended the “Interlocked” functions for my own use to fill some holes in the
API set and I need to check on an MP-related issue. I’d really appreciate it if
someone could pop into a debugger and post the dump of one of these babies for
me.

At 17.06 08/05/2002, you wrote:

I need to see the disassembly for one of the “Interlocked” functions on a
multiprocessor kernel. InterlockedIncrement() should be
fine. Unfortunately, I don’t have ready debugging access to an MP machine
at this moment.

Taken from ReactOS (http:</http:>) - sorry for the ATT syntax:

LONG
STDCALL
InterlockedIncrement(PLONG Addend)
{
long ret = 0;
asm
(
“\tlock\n” /* for SMP systems */
“\tincl (%1)\n”
“\tje 2f\n”
“\tjl 1f\n”
“\tincl %0\n”
“\tjmp 2f\n”
“1:\tdec %0\n”
“2:\n”
:“=r” (ret):“r” (Addend), “0” (0): “memory”
);
return ret;
}

I think the “magic” is all in the lock instruction