[PERF]: Do not declare the PCR in KeGetPcr as volatile. It is only volatile as in "if there is a context switch, the PCR is different". You are in a LOT of trouble if the thread switches while your code is running in the first place, and your code is somehow running as a different thread!

This change makes C code a lot neater, especially during PCR access, because it doesn't force reloading the PCR each time. For example, Read-Modify-Operations on the PCR, such as AND are 1 line of assembly instead of 3.
This helps and will help further with the C HAL, as well as the C trap handlers.

svn path=/trunk/; revision=45210
This commit is contained in:
Sir Richard 2010-01-23 18:28:14 +00:00
parent 41563f3396
commit c030074001

View file

@ -27,10 +27,10 @@ Author:
// KPCR Access for non-IA64 builds
//
#define K0IPCR ((ULONG_PTR)(KIP0PCRADDRESS))
#define PCR ((volatile KPCR * const)K0IPCR)
#define PCR ((KPCR * const)K0IPCR)
#if defined(CONFIG_SMP) || defined(NT_BUILD)
#undef KeGetPcr
#define KeGetPcr() ((volatile KPCR * const)__readfsdword(0x1C))
#define KeGetPcr() ((KPCR * const)__readfsdword(FIELD_OFFSET(KPCR, Self)))
#endif
//