Hi,
I'm reading a book about rootkits and I came across the following lines of code:
1) Is that "nop" really necessary or even meaningful?
2) Shouldn't we read the old value returned by InterlockedCompareExchange instead?
Thank you.
I'm reading a book about rootkits and I came across the following lines of code:
Code: Select all
I have a few questions:InterlockedCompareExchange(&nCPUsLocked, nOtherCPUs, nOtherCPUs);
while (nCPUsLocked != nOtherCPUs)
{
__asm
{
nop;
}
InterlockedCompareExchange(&nCPUsLocked, nOtherCPUs, nOtherCPUs);
}
1) Is that "nop" really necessary or even meaningful?
2) Shouldn't we read the old value returned by InterlockedCompareExchange instead?
Thank you.