Re: KeGetCurrentProcessorNumber returning wrong value?

Tech-Archive recommends: Fix windows errors by optimizing your registry



The googles seems to have somebody else complaining about this on a w2k3 x64 system here : http://article.gmane.org/gmane.comp.emulators.xen.devel/47654

This is a dual core amd systme. Then again he is also running Xen, so who knows what is actually going on.

KeGetCurrentProcessorNumber just fetches to processor number out of the KPCR structure for the current processor on an x86 system - windbg can do the same thing and dump the entire structure as well. On an x64 system it does this:
__forceinline
ULONG
KeGetCurrentProcessorNumber (
VOID
)

{

return (ULONG)__readgsword(0x184);
}

where readgsword is one of a collection of functions for the x64 that " Define functions to read and write the uer TEB and the system PCR/PRCB." Once again perhaps windbg and a timely debug breakpoint would help.

Also here: http://msdn2.microsoft.com/en-us/library/bb332189.aspx


"Andy Grover" <andy.grover@xxxxxxxxxx> wrote in message news:OsiGMcxXIHA.2268@xxxxxxxxxxxxxxxxxxxxxxx
A friend of mine is seeing this function return 256, on a system with 2 CPUs. Why might it be doing this?

Thanks -- Andy

.